awscurl icon indicating copy to clipboard operation
awscurl copied to clipboard

Plans to add multipart requests support?

Open Envek opened this issue 4 years ago • 3 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 avatar Feb 01 '21 18:02 Envek

Looks rather interesting: https://curl.se/docs/manpage.html#-F

okigan avatar Feb 01 '21 19:02 okigan

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

okigan avatar Feb 03 '21 20:02 okigan

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

Envek avatar Feb 04 '21 11:02 Envek