What are the differences and advantages of using one over the other:
Accept: application/json;charset=utf-8
versus:
Accept: application/json
Accept-Charset: utf-8
Is the first form compliant to rfc 2616?
Note: could be json or xml, etc.
The Accept-Encoding request HTTP header indicates the content encoding (usually a compression algorithm) that the client can understand. The server uses content negotiation to select one of the proposals and informs the client of that choice with the Content-Encoding response header.
The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is “UNKNOWN” string which indicates the encoding equals to the encoding of the document containing the <form> element. Syntax: <form accept-charset = "character_set">
It's up to you to decide whether you want to reject requests with Accept headers or not.
Accept header is used by HTTP clients to tell the server which type of content they expect/prefer as response. Content-type can be used both by clients and servers to identify the format of the data in their request (client) or response (server) and, therefore, help the other part interpret correctly the information.
Both of them are compliant. But I prefer second one.
"charset" parameter is for media type and media types are defined by IANA, not by RFC 2616.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With