Factor Three
Factor Three

Reputation: 2284

A generic byte response type?

I am writing a RESTful service that returns an array of bytes. I know of several response types associated with HTTP, including text/html, application/xml, and image/png (among several others). I am unaware of a response type that would be associated with a generic array of bytes.

Does such a response type exist? I don't want to send the bytes as text, and none of the image types seem appropriate. Is there a kind of "byte" type that represents an array of bytes?

Someone please advise...

Upvotes: 0

Views: 1146

Answers (2)

user5986440
user5986440

Reputation:

You can send binary data using 'application/octet-stream`.

Here is a full list of MIME Content-Types

Upvotes: 1

Andreas
Andreas

Reputation: 159106

application/octet-stream is registered with IANA for this purpose:

The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.

It is actually defined in RFC 2046, section 4.5.1.

Upvotes: 1

Related Questions