Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Attaching binary files to requests doesn't work #269

Open
wusticality opened this issue Oct 5, 2021 · 0 comments
Open

Attaching binary files to requests doesn't work #269

wusticality opened this issue Oct 5, 2021 · 0 comments

Comments

@wusticality
Copy link

Hey @pashky, thanks for such a fantastic Emacs package. :)

Binary files are not attached properly to requests when specified as an external file. For example, something like this:

POST http://foobar.com
Content-type: application/gzip

< /path/to/some/file.json.gz

I've verified that this is broken by running the corresponding command in curl:

curl -X "POST" --data-binary "@/path/to/some/file.json.gz" -H "Content-Type: application/gzip" http://foobar.com

I had to use --data-binary instead of -d on the command line to attach the gzipped file. It looks like restclient.el always emits -d when extracting the request as a curl command. I'm guessing that the code doesn't necessarily use curl internally and will need to be fixed in multiple places.

Perhaps there should be different syntax for attaching binary files? Perhaps something like this:

POST http://foobar.com
Content-type: application/gzip

& /path/to/some/file.json.gz

Thanks very much for all your hard work!

Cheers, K

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant