diff --git a/ChangeLog b/ChangeLog index fa09d90c0..5a2372182 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-03-10 Adam Fedor + + * Source/NSURLProtocol.m ([_NSHTTPURLProtocol -stream:stream:event]): + Add default Content-Type to POST methods if none is present. + 2010-03-09 Adam Fedor * Source/NSHTTPCookie.m: Finish off implementation diff --git a/Source/NSURLProtocol.m b/Source/NSURLProtocol.m index 04af85c44..79d578a6e 100644 --- a/Source/NSURLProtocol.m +++ b/Source/NSURLProtocol.m @@ -1304,6 +1304,12 @@ static NSURLProtocol *placeholder = nil; [m appendString: [d objectForKey: s]]; [m appendString: @"\r\n"]; } + if ([[this->request HTTPMethod] isEqual: @"POST"] + && [d objectForKey: @"Content-Type"] == nil) + { + /* On MacOSX, this is automatically added to POST methods */ + [m appendString: @"Content-Type: application/x-www-form-urlencoded\r\n"]; + } if ([this->request valueForHTTPHeaderField: @"Host"] == nil) { id p = [u port];