[Obj-C] Fixed an issue where NSNumber parameters would cause a crash in multipart/form-data upload endpoints

This commit is contained in:
Matthew Davis 2015-09-11 17:23:48 -07:00
parent 46f78f2180
commit 1321d5f9a5

View File

@ -115,6 +115,9 @@ static {{classname}}* singletonAPI = nil;
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
{{#headerParams}}if({{paramName}} != nil)
if([{{paramName}} isKindOfClass:[NSNumber class]]){
headerParams[@"{{baseName}}"] = [((NSNumber *){{paramName}}) stringValue];
}
headerParams[@"{{baseName}}"] = {{paramName}};
{{/headerParams}}
@ -148,6 +151,9 @@ static {{classname}}* singletonAPI = nil;
{{#formParams}}
{{#notFile}}
if ({{paramName}}) {
if([{{paramName}} isKindOfClass:[NSNumber class]]){
formParams[@"{{baseName}}"] = [((NSNumber *){{paramName}}) stringValue];
}
formParams[@"{{baseName}}"] = {{paramName}};
}
{{/notFile}}{{#isFile}}