Skip to content
Advertisement

curl: What’s the difference between -d and –data-binary options?

I’m trying to send a post request to a REST API. I noticed that everything works fine when I pass parameters with -d option in curl. Example:

JavaScript

However, if a send parameters as a json object and using –data-binary, I receive an error from the Api (as if no parameters were received). Example:

JavaScript

I thought the two approaches had the same behavior, but I think I’m wrong. What’s the difference between these two approaches?

P.S.: the second request is the curl request that I get when select copy as cURL option on Google Chrome, because the actual request is a $http.post in Angular with its data payload as a JSON object. What can I do in Angular to get it working?

JavaScript

Advertisement

Answer

This is what I got with curl --help:

JavaScript

So, the difference is just that with -d data sent is not binary content.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement