开发者

What is forHTTPHeaderField:@"Content-Type" in objective C

开发者 https://www.devze.com 2023-01-05 23:17 出处:网络
I want to ask an question about the objective C. What is \"content-type\" in the NSMutableURLRequest? Is it related to the header field as I see the forHTTPHeaderField?

I want to ask an question about the objective C. What is "content-type" in the NSMutableURLRequest? Is it related to the header field as I see the forHTTPHeaderField?

Also, what is the different between the following statement?

// statement 1
[req开发者_开发知识库uest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

// statement 2
[request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];

Thank you very much.


Content-type is known as a MIME type that indicates what kind of data an HTTP response contains.

Here is more information about MIME types and some examples: http://en.wikipedia.org/wiki/MIME

For a full list of official MIME types approved by the IANA, take a look here: http://www.iana.org/assignments/media-types/

To answer your other question:

  • Statement 1 is a MIME type for a response to a web form that has been filled in.

  • Statement 2 is the MIME type for a standard HTML page which has a characterset of UTF-8 (basically, international support versus standard ASCII or something else).

0

精彩评论

暂无评论...
验证码 换一张
取 消