KKJSBridgeAjaxURLProtocol.m 处理form表单的问题
dhui68 opened this issue · 4 comments
dhui68 commented
KKJSBridgeAjaxURLProtocol.m 178行代码,处理form表单的问题
有些form提交不支持multipart/form-data,应该兼容更多form的enctype属性,如(application/x-www-form-urlencoded,multipart/form-data,text/plain),针对application/x-www-form-urlencoded还需要重新设置Content-Length
karosLi commented
1.1.5-beta3 已经支持了表单的另两种编码了 application/x-www-form-urlencoded 和 text/plain
karosLi commented
这个有解决你的问题吗,有的话,我就关掉了
dhui68 commented
这个有解决你的问题吗,有的话,我就关掉了
数据拼接的时候,[string appendFormat:@"%@=%@", [self encodeString:key], [self encodeString: params[key]]];, 需要urlencode一下,
-
(NSString *) encodeString:(NSString *)unencodedString
{
if([[[UIDevicecurrentDevice]systemVersion]floatValue] >=9.0)
{return[unencodedString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]]; } NSString*encodedString = (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)unencodedString,NULL,(CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8)); returnencodedString;
}
karosLi commented
嗯,1.1.5-beta6 已经修正