WebAppKit icon indicating copy to clipboard operation
WebAppKit copied to clipboard

Incorrect handling of POST requests

Open mikecsh opened this issue 14 years ago • 1 comments

Hi tomasf,

Thanks for your help on IRC the other day. After several hours analysing tcpflow traces I've narrowed down the problem. WAK does not handle POST parameters unless the Content-Type HTTP header is set to application/x-www-form-urlencoded. In fact there is a comment on line 265 of WARequest.m where this is checked which simply says "jesus. fix" :)

I don't know how to approach a patch for this as it currently calls the dictionaryFromQueryParameters method which obviously parses a standard query string. My application uses Content-Type application/json and the body is a JSON string. An NSString would seem a more appropriate return choice here.

What do you think the best approach is?

Thanks, Mike

mikecsh avatar Oct 10 '11 14:10 mikecsh

Yeah, WARequest ought to have some general handling of types that are not urlencoded or multipart. Reading the data (with a maximum length) into an NSData buffer and then exposing that as a property could work.

tomasf avatar Oct 10 '11 16:10 tomasf