developit / redaxios

The Axios API, as an 800 byte Fetch wrapper.

Home Page:https://npm.im/redaxios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Put request doesnt work (reopened from #76)

patchthecode opened this issue · comments

get, post works as expected.

But put doesnt work. When i look at the network request, it is not even sent. The following is what a successful request should look like when i use the real axios.

Request headers -->

PUT /images/4066f071-82c1-45e2-8b7d-20f4875a6119.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=patchthecode%2F20220314%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220314T223914Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&partNumber=1&uploadId=ead03faa-359e-43df-8b4f-0561ac104edf&x-id=UploadPart&X-Amz-Signature=748d1674466bf767f038553e900ba01becde820c12a17021ca5f40012f5b3f45 HTTP/1.1
Host: localhost:9000
Connection: keep-alive
Content-Length: 75558
Accept: application/json
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1
Content-Type: application/json
Origin: http://localhost:3001
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:3001/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

Response header

HTTP/1.1 200 OK
Server: nginx/1.19.2
Date: Mon, 14 Mar 2022 22:39:43 GMT
Content-Length: 0
Connection: keep-alive
Accept-Ranges: bytes
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:3001
Access-Control-Expose-Headers: Date, Etag, Server, Connection, Accept-Ranges, Content-Range, Content-Encoding, Content-Length, Content-Type, Content-Disposition, Last-Modified, Content-Language, Cache-Control, Retry-After, X-Amz-Bucket-Region, Expires, X-Amz*, X-Amz*, *
Content-Security-Policy: block-all-mixed-content
ETag: "74ae190eeeae3b62ee4a2188b10d5251"
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Request-Id: 16DC606CBABDE3E8
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

I used Chrome for this.
Version 99.0.4844.51 (Official Build) (x86_64)

the issue happens here with this code

http.put(presignedUrls[i], fileChunks[i])

presignedUrls[i] = a long URL
fileChunks[i] = a file blob

With the real Axios, you can correctly see the blob (file image) in the request payload on Chrome.
But with this redaxios, this payload is empty.

This isnt a CORS issue as the real axios works, and there are no CORS erros in the browser logs, and also, the request actually went through (but without a payload.. as mentioned above the payload is empty)