okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plans to add multipart requests support?

Envek opened this issue · comments

What do you think about adding multipart/form-data requests that are made with -F option in curl?

It would be awesome for testing endpoints for file uploads that are located on API Gateways with AWS Auth enabled.

Example [aws]curl command:

awscurl \
        -X POST \
        -H "Content-Type: multipart/form-data" \
        -F "field1=value1" \
        -F 'field2={"some":"json"};type=application/json' \
        -F "file=@/path/to/some/picture.png" \
        https://redacted.execute-api.us-west-2.amazonaws.com/path

Expected request body:

--------------------------d9afcbc8f3fe869a
Content-Disposition: form-data; name="field1"

value1
--------------------------d9afcbc8f3fe869a
Content-Disposition: form-data; name="field2"
Content-Type: application/json

{"some":"json"}
--------------------------d9afcbc8f3fe869a
Content-Disposition: form-data; name="file"; filename="picture.png"
Content-Type: image/png

<binary data>
--------------------------d9afcbc8f3fe869a--

@Envek would you like to start a PR or how would you like to move it forward?

I'm not proficient in Python, unfortunately. Probably won't be able to dive into it in the nearest future.