Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 上传到s3,响应对象_Reactjs_Amazon Web Services_Amazon S3 - Fatal编程技术网

Reactjs 上传到s3,响应对象

Reactjs 上传到s3,响应对象,reactjs,amazon-web-services,amazon-s3,Reactjs,Amazon Web Services,Amazon S3,在我的react应用程序中,我将文件上载到S3 似乎上传正常,但我没有从服务器得到任何响应 这是我的代码: if(awsUrl.url){ console.log(awsUrl) const res = await fetch(awsUrl.url, { method: 'PUT', body: formData, headers: { "Content-Type": "

在我的react应用程序中,我将文件上载到S3

似乎上传正常,但我没有从服务器得到任何响应

这是我的代码:

if(awsUrl.url){
      console.log(awsUrl)
        const res = await fetch(awsUrl.url, {
        method: 'PUT',
        body: formData,
        headers: {
          "Content-Type": "multipart/form-data"
        }
      }).then(response => response)
        if(res.ok) {
          alert("upload success")

      }
反应还可以

如何从s3请求中获取json响应


通常要在获取响应中检索JSON正文,可以使用
response.JSON()
。你确定主体实际上是JSON吗?您的devtools网络选项卡显示什么?