开发者

ASIHTTPRequest accept headers (406 error)

开发者 https://www.devze.com 2023-03-23 07:39 出处:网络
I\'m currently playing with the Freckle API in an iOS app and I\'m being returned a 406 HTTP error. I tested with some other frameworks and they do return the content presented by the API. But with AS

I'm currently playing with the Freckle API in an iOS app and I'm being returned a 406 HTTP error. I tested with some other frameworks and they do return the content presented by the API. But with ASIHTTPRequest, a ’406 Not Acceptable’ error is all I'm getting.

Try doing a GET request to the following url: https://apitest.letsfreckle.com/api/projects.json?token=lx3gi6pxdjtjn57afp8c2bv1me7g89j

I'm wondering why this is happening. Does anyone have an idea why and a possible fix? I'm pretty sure it has to do with accept-headers, though haven't fou开发者_StackOverflow中文版nd a way to fix it.

Thanks


This is not a framework problem. The problem might be with the parameters that you are sending. Or even the header. Send the header as the following method:

NSString *headerString = [NSString stringWithFormat:@"%@=%@", sesske, sessid];

[request addRequestHeader:@"Cookie" value:headerString]; 

[request setRequestMethod:@"POST"];

if you have no header do it as below:

[request setRequestMethod:@"POST"];
        [request addRequestHeader:@"Accept" value:@"application/json"];

Check each and every parameter and spelling properly before sending. let me know if that works. If that does not work please give more information on the question like what is the web service that you are trying to call and everything.

0

精彩评论

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