mkeathley
mkeathley

Reputation: 269

NSMutableURLRequest custom header causing request to fail

I am making a GET request for JSON data from a server that requires custom headers. The server responds with accurate response codes when I add the authentication header but fails during the custom header.

This -

[request addValue:utcDate forHTTPHeaderField:@"­X-Custom-Date"];

causes the request to not receive a response from the server.

I can add the identical headers in a curl command and get a response so it is something particular to the NSMutableURLRequest class.

Has anyone encounter this issue?

Upvotes: 2

Views: 410

Answers (1)

mkeathley
mkeathley

Reputation: 269

The HTTP header in the above question was copied from an PDF API document. Apparently it pasted in a character that is not displayed and caused the request to fail.

You can copy the above request line into a program like vi and you will find the additional character before the X.

I have been searching for a way to force Xcode to display ALL characters without success.

Upvotes: 2

Related Questions