当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

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

[request 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).

分享给朋友:
您可能感兴趣的文章:
随机阅读: