Can I get status text from NSHTTPURLResponse message?

If I use NSURLConnection to receive data from the server, and it sends a response that starts with, say:

HTTP / 1.1 406 Some line of text here

Is there a way to get the status text "Some line of text here"? I know how to get the status code, and I know about localizedStringForStatusCode: but in this case I need access to certain text sent back.

+4
source share
1 answer

You can use ASIHTTPRequest , which exposes this as -requestStatusMessage . Or you can use Core Foundation CFHTTP , which provides CFHTTPMessageCopyResponseStatusLine . Unfortunately, I do not believe that there is a good way to get to CFHTTPMessage from NSHTTPURLResponse . Of course, ASIHTTPRequest is pretty awesome anyway.

+5
source

Source: https://habr.com/ru/post/1347295/


All Articles