@@ -12,10 +12,10 @@ var _ = require('./lodash'),
1212 * @param {String } indent indentation required for code snippet
1313 * @param {Boolean } trim indicates whether to trim string or not
1414 */
15- function parseRawBody ( body , indent , trim ) {
15+ function parseRawBody ( body , indent , trim ) {
1616 var bodySnippet = '' ;
1717 bodySnippet += 'NSData *postData = [[NSData alloc] initWithData:[@"' + sanitize ( body . toString ( ) , trim ) + '" ' +
18- 'dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
18+ 'dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
1919 bodySnippet += '[request setHTTPBody:postData];\n' ;
2020 return bodySnippet ;
2121}
@@ -27,11 +27,11 @@ function parseRawBody (body, indent, trim) {
2727 * @param {String } indent indentation required for code snippet
2828 * @param {Boolean } trim indicates whether to trim string or not
2929 */
30- function parseGraphQLBody ( body , indent , trim ) {
30+ function parseGraphQLBody ( body , indent , trim ) {
3131 var bodySnippet = '' ,
3232 rawBody = JSON . stringify ( body ) ;
3333 bodySnippet += 'NSData *postData = [[NSData alloc] initWithData:[@"' + sanitize ( rawBody , trim ) + '" ' +
34- 'dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
34+ 'dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
3535 bodySnippet += '[request setHTTPBody:postData];\n' ;
3636 return bodySnippet ;
3737}
@@ -43,7 +43,7 @@ function parseGraphQLBody (body, indent, trim) {
4343 * @param {String } indent indentation required for code snippet
4444 * @param {Boolean } trim indicates whether to trim string or not
4545 */
46- function parseURLEncodedBody ( body , indent , trim ) {
46+ function parseURLEncodedBody ( body , indent , trim ) {
4747 let bodySnippet = '' ,
4848 key ,
4949 value ,
@@ -54,11 +54,11 @@ function parseURLEncodedBody (body, indent, trim) {
5454 value = trim ? data . value . trim ( ) : data . value ;
5555 if ( first ) {
5656 bodySnippet += 'NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"' +
57- sanitize ( key , true ) + '=' + sanitize ( value , trim ) + '" dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
57+ sanitize ( key , true ) + '=' + sanitize ( value , trim ) + '" dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
5858 }
5959 else {
6060 bodySnippet += '[postData appendData:[@"&' + sanitize ( key , true ) + '=' + sanitize ( value , trim ) +
61- '" dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
61+ '" dataUsingEncoding:NSUTF8StringEncoding]];\n' ;
6262 }
6363 first = false ;
6464 }
@@ -74,7 +74,7 @@ function parseURLEncodedBody (body, indent, trim) {
7474 * @param {String } indent indentation required for code snippet
7575 * @param {Boolean } trim indicates whether to trim string or not
7676 */
77- function parseFormData ( body , indent , trim ) {
77+ function parseFormData ( body , indent , trim ) {
7878 let bodySnippet = '' ,
7979 formDataArray = [ ] ,
8080 key ,
@@ -143,7 +143,7 @@ function parseFormData (body, indent, trim) {
143143 * @param {String } indent indentation required for code snippet
144144 * @param {trim } trim indicates whether to trim string or not
145145 */
146- function parseBody ( body , indent , trim ) {
146+ function parseBody ( body , indent , trim ) {
147147 if ( ! _ . isEmpty ( body ) ) {
148148 switch ( body . mode ) {
149149 case 'urlencoded' :
@@ -170,7 +170,7 @@ function parseBody (body, indent, trim) {
170170 * @param {String } indent indentation required for code snippet
171171 * @param {Boolean } trim indicates whether to trim string or not
172172 */
173- function parseHeaders ( headersArray , indent , trim ) {
173+ function parseHeaders ( headersArray , indent , trim ) {
174174 var headerString = '' ,
175175 headerDictionary = [ ] ;
176176 if ( _ . isEmpty ( headersArray ) ) {
@@ -265,8 +265,7 @@ self = module.exports = {
265265 codeSnippet += 'dispatch_semaphore_t sema = dispatch_semaphore_create(0);\n\n' ;
266266
267267 finalUrl = new sdk . Url ( request . url . toString ( ) ) ;
268- // URL encoding each part of Url individually
269- finalUrl = `${ finalUrl . protocol } ://${ finalUrl . getRemote ( ) } ${ finalUrl . getPathWithQuery ( true ) } ` ;
268+ finalUrl = finalUrl . toString ( ) ;
270269
271270 codeSnippet += 'NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"' +
272271 finalUrl + '"]\n' ;
@@ -299,7 +298,7 @@ self = module.exports = {
299298
300299 // if boilerplate is included then two more indent needs to be added in snippet
301300 ( options . includeBoilerplate ) &&
302- ( codeSnippet = indent + codeSnippet . split ( '\n' ) . join ( '\n' + indent ) + '\n' ) ;
301+ ( codeSnippet = indent + codeSnippet . split ( '\n' ) . join ( '\n' + indent ) + '\n' ) ;
303302
304303 callback ( null , headerSnippet + codeSnippet + footerSnippet ) ;
305304 } ,
@@ -328,7 +327,7 @@ self = module.exports = {
328327 // TODO: Find out a way to set infinite timeout.
329328 default : 10000 ,
330329 description : 'Set number of milliseconds the request should wait for a response' +
331- ' before timing out (use 0 for infinity)'
330+ ' before timing out (use 0 for infinity)'
332331 } ,
333332 {
334333 name : 'Trim request body fields' ,
0 commit comments