Scaraffe
Scaraffe

Reputation: 5241

mime-encoded as application/octet-stream

I am doing curl POST to a service with body containing some json data. I am getting the response as "request body was not mime-encoded as application/octet-stream". What does the response mean?

Upvotes: 2

Views: 4564

Answers (2)

Richard J
Richard J

Reputation: 7313

You probably need to supply a Content-Type header. Depending on what your web server is expecting, you might want to supply it either the mimetype "text/plain" or perhaps "application/x-www-form-urlencoded". In Curl, just include the argument:

-H "Content-Type: text/plain"

So your request will be something like:

curl -i -X POST --data-binary "@your.json" -H "Content-Type: text/plain"

Or substitute "text/plain" for the appropriate mime-type.

So, probably what's happening at the moment is that your web server is being given the content type application/octet-stream, and not understanding what to do with your plain text json content. If you run curl with "-v" it will give you a verbose description of the sent and received headers so you can see what Content-Type it's giving your server by default.

Upvotes: 2

000
000

Reputation: 280

The input have to be a "application".

What you asking for is a mimetype.

Read more here: http://en.wikipedia.org/wiki/Internet_media_type

Please add more information for more informations.

Upvotes: -1

Related Questions