0

In a socket programming, I must display multiple Content-Types.

ex)

Content-Type : text/html, text/css, text/javascript, image/png

However, this code doesn't work. How can I display multiple Content-Type in a HTTP response message? Thank you...

김성민
  • 5
  • 1
  • 2
  • Possible duplicate of [Does the HTTP Protocol support multiple content types in response headers?](https://stackoverflow.com/questions/5809099/does-the-http-protocol-support-multiple-content-types-in-response-headers) – Helen Feb 22 '18 at 10:48

1 Answers1

2

Content-Type means should be only one type based on the requester's Accept parameter of a default content type you may specify, however if your client is interested in a specific type, it should send the type he wants in Accept request header and you should respond back with the requested content type.

requester may send multiple types through to say for example

Accept: application/json
Accept: text/html

which means the requester can understand both types. If server can serve and respond back in json format otherwise it should response back with text/html

More info on Content-Type header and other HTTP specs, please check this

Muhammad Soliman
  • 21,644
  • 6
  • 109
  • 75