@@ -64,39 +64,5 @@ module.exports = {
6464 default :
6565 return '@"' + value . replace ( / " / g, '\\"' ) + '"'
6666 }
67- } ,
68-
69- /**
70- * By appending multipart parameters one by one in the resulting snippet,
71- * we make it easier for the user to edit it according to his or her needs after pasting.
72- * The user can just edit the parameters NSDictionary or put this part of a snippet in a multipart builder method.
73- */
74- multipartBody : function ( source , opts ) {
75- var code = [ ]
76- var indent = opts . indent
77-
78- code . push ( this . nsDeclaration ( 'NSArray' , 'parameters' , source . postData . params , opts . pretty ) )
79- code . push ( util . format ( 'NSString *boundary = @"%s";' , source . postData . boundary ) )
80- code . push ( null )
81- code . push ( 'NSError *error;' )
82- code . push ( 'NSMutableString *body = [NSMutableString string];' )
83- code . push ( 'for (NSDictionary *param in parameters) {' )
84- code . push ( indent + '[body appendFormat:@"--%@\\r\\n", boundary];' )
85- code . push ( indent + 'if (param[@"fileName"]) {' )
86- code . push ( indent + indent + '[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];' )
87- code . push ( indent + indent + '[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];' )
88- code . push ( indent + indent + '[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];' )
89- code . push ( indent + indent + 'if (error) {' )
90- code . push ( indent + indent + indent + 'NSLog(@"%@", error);' )
91- code . push ( indent + indent + '}' )
92- code . push ( indent + '} else {' )
93- code . push ( indent + indent + '[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];' )
94- code . push ( indent + indent + '[body appendFormat:@"%@", param[@"value"]];' )
95- code . push ( indent + '}' )
96- code . push ( '}' )
97- code . push ( '[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];' )
98- code . push ( 'NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];' )
99-
100- return code . join ( '\n' )
10167 }
10268}
0 commit comments