Binary Request and Postman-Generated curl Command
After using PostMan to test a web service, I decided to share a way to connect to the service with my team mate so I used PostMan to generate the curl
command. It seems like a simple enough use case and that’s exactly what most people would do with PostMan, except that I had a web service to which I was posting a binary request body and I kept getting an error when executing the curl statement. After much pondering (okay, so it wasn’t that much…), I noticed that the generated curl command uses --data
and I found the man page for curl which mentions the --data-binary
option. I changed the option and SUCCESS!
curl --request GET --location 'http://localhost:8080' --header 'Content-Type: application/octet-stream' --header 'Accept: application/octet-stream' --data-binary '@mydata.dat'