Add trailing commas to ESLint + Prettier

This commit is contained in:
Gregory Schier committed 2018-12-12 12:36:11 -05:00
1 parent 64a5e44528
commit 88b0bb784f
404 files changed
+2575 -2571

No files matched your search

@@ -21,5 +21,5 @@ module.exports = {
escape: function(value) {
return value.replace(/\r/g, '\\r').replace(/\n/g, '\\n');
}
},
};
+5 -5
View File
@@ -24,8 +24,8 @@ var HTTPSnippet = function(data) {
} else {
entries = [
{
request: input
}
request: input,
},
];
}
@@ -112,14 +112,14 @@ HTTPSnippet.prototype.prepare = function(request) {
request.postData.params.forEach(function(param) {
form.append(param.name, param.value || '', {
filename: param.fileName || null,
contentType: param.contentType || null
contentType: param.contentType || null,
});
});
form.pipe(
es.map(function(data, cb) {
request.postData.text += data;
})
}),
);
request.postData.boundary = form.getBoundary();
@@ -178,7 +178,7 @@ HTTPSnippet.prototype.prepare = function(request) {
// update the uri object
request.uriObj.query = request.queryObj;
request.uriObj.search = qs.stringify(request.queryObj, '&', '=', {
encodeURIComponent: request.settingEncodeUrl ? null : str => str
encodeURIComponent: request.settingEncodeUrl ? null : str => str,
});
if (request.uriObj.search) {
@@ -5,8 +5,8 @@ module.exports = {
key: 'c',
title: 'C',
extname: '.c',
default: 'libcurl'
default: 'libcurl',
},
libcurl: require('./libcurl')
libcurl: require('./libcurl'),
};
@@ -45,5 +45,5 @@ module.exports.info = {
key: 'libcurl',
title: 'Libcurl',
link: 'http://curl.haxx.se/libcurl/',
description: 'Simple REST and HTTP API Client for C'
description: 'Simple REST and HTTP API Client for C',
};
@@ -5,8 +5,8 @@ module.exports = {
key: 'csharp',
title: 'C#',
extname: '.cs',
default: 'restsharp'
default: 'restsharp',
},
restsharp: require('./restsharp')
restsharp: require('./restsharp'),
};
@@ -34,7 +34,7 @@ module.exports = function(source, options) {
code.push(
'request.AddParameter("%s", %s, ParameterType.RequestBody);',
source.allHeaders['content-type'],
JSON.stringify(source.postData.text)
JSON.stringify(source.postData.text),
);
}
@@ -46,5 +46,5 @@ module.exports.info = {
key: 'restsharp',
title: 'RestSharp',
link: 'http://restsharp.org/',
description: 'Simple REST and HTTP API Client for .NET'
description: 'Simple REST and HTTP API Client for .NET',
};
@@ -5,8 +5,8 @@ module.exports = {
key: 'go',
title: 'Go',
extname: '.go',
default: 'native'
default: 'native',
},
native: require('./native')
native: require('./native'),
};
@@ -23,9 +23,9 @@ module.exports = function(source, options) {
showBoilerplate: true,
checkErrors: false,
printBody: true,
timeout: -1
timeout: -1,
},
options
options,
);
var errorPlaceholder = opts.checkErrors ? 'err' : '_';
@@ -94,7 +94,7 @@ module.exports = function(source, options) {
indent,
'req, %s := http.NewRequest("%s", url, payload)',
errorPlaceholder,
source.method
source.method,
)
.blank();
} else {
@@ -146,5 +146,5 @@ module.exports.info = {
key: 'native',
title: 'NewRequest',
link: 'http://golang.org/pkg/net/http/#NewRequest',
description: 'Golang HTTP client request'
description: 'Golang HTTP client request',
};
@@ -13,5 +13,5 @@ module.exports = {
python: require('./python'),
ruby: require('./ruby'),
shell: require('./shell'),
swift: require('./swift')
swift: require('./swift'),
};
@@ -5,9 +5,9 @@ module.exports = {
key: 'java',
title: 'Java',
extname: '.java',
default: 'unirest'
default: 'unirest',
},
okhttp: require('./okhttp'),
unirest: require('./unirest')
unirest: require('./unirest'),
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -34,14 +34,14 @@ module.exports = function(source, options) {
code.push(
'MediaType mediaType = MediaType.parse("%s; boundary=%s");',
source.postData.mimeType,
source.postData.boundary
source.postData.boundary,
);
} else {
code.push('MediaType mediaType = MediaType.parse("%s");', source.postData.mimeType);
}
code.push(
'RequestBody body = RequestBody.create(mediaType, %s);',
JSON.stringify(source.postData.text)
JSON.stringify(source.postData.text),
);
}
@@ -85,5 +85,5 @@ module.exports.info = {
key: 'okhttp',
title: 'OkHttp',
link: 'http://square.github.io/okhttp/',
description: 'An HTTP Request Client Library'
description: 'An HTTP Request Client Library',
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -29,13 +29,13 @@ module.exports = function(source, options) {
code.push(
'HttpResponse<String> response = Unirest.customMethod("%s","%s")',
source.method.toUpperCase(),
source.fullUrl
source.fullUrl,
);
} else {
code.push(
'HttpResponse<String> response = Unirest.%s("%s")',
source.method.toLowerCase(),
source.fullUrl
source.fullUrl,
);
}
@@ -62,5 +62,5 @@ module.exports.info = {
key: 'unirest',
title: 'Unirest',
link: 'http://unirest.io/java.html',
description: 'Lightweight HTTP Request Client Library'
description: 'Lightweight HTTP Request Client Library',
};
@@ -5,9 +5,9 @@ module.exports = {
key: 'javascript',
title: 'JavaScript',
extname: '.js',
default: 'xhr'
default: 'xhr',
},
jquery: require('./jquery'),
xhr: require('./xhr')
xhr: require('./xhr'),
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -28,7 +28,7 @@ module.exports = function(source, options) {
crossDomain: true,
url: source.fullUrl,
method: source.method,
headers: source.allHeaders
headers: source.allHeaders,
};
switch (source.postData.mimeType) {
@@ -48,7 +48,7 @@ module.exports = function(source, options) {
code.push(
'form.append(%s, %s);',
JSON.stringify(param.name),
JSON.stringify(param.value || param.fileName || '')
JSON.stringify(param.value || param.fileName || ''),
);
});
@@ -72,7 +72,7 @@ module.exports = function(source, options) {
code
.push(
'var settings = ' + JSON.stringify(settings, null, opts.indent).replace('"[form]"', 'form')
'var settings = ' + JSON.stringify(settings, null, opts.indent).replace('"[form]"', 'form'),
)
.blank()
.push('$.ajax(settings).done(function (response) {')
@@ -86,5 +86,5 @@ module.exports.info = {
key: 'jquery',
title: 'jQuery',
link: 'http://api.jquery.com/jquery.ajax/',
description: 'Perform an asynchronous HTTP (Ajax) requests with jQuery'
description: 'Perform an asynchronous HTTP (Ajax) requests with jQuery',
};
@@ -17,9 +17,9 @@ module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' ',
cors: true
cors: true,
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -29,7 +29,7 @@ module.exports = function(source, options) {
code
.push(
'var data = JSON.stringify(%s);',
JSON.stringify(source.postData.jsonObj, null, opts.indent)
JSON.stringify(source.postData.jsonObj, null, opts.indent),
)
.push(null);
break;
@@ -41,7 +41,7 @@ module.exports = function(source, options) {
code.push(
'data.append(%s, %s);',
JSON.stringify(param.name),
JSON.stringify(param.value || param.fileName || '')
JSON.stringify(param.value || param.fileName || ''),
);
});
@@ -77,7 +77,7 @@ module.exports = function(source, options) {
code.push(
'xhr.setRequestHeader(%s, %s);',
JSON.stringify(key),
JSON.stringify(source.allHeaders[key])
JSON.stringify(source.allHeaders[key]),
);
});
@@ -90,5 +90,5 @@ module.exports.info = {
key: 'xhr',
title: 'XMLHttpRequest',
link: 'https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest',
description: 'W3C Standard API that provides scripted client functionality'
description: 'W3C Standard API that provides scripted client functionality',
};
@@ -5,10 +5,10 @@ module.exports = {
key: 'node',
title: 'Node.js',
extname: '.js',
default: 'native'
default: 'native',
},
native: require('./native'),
request: require('./request'),
unirest: require('./unirest')
unirest: require('./unirest'),
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -28,7 +28,7 @@ module.exports = function(source, options) {
hostname: source.uriObj.hostname,
port: source.uriObj.port,
path: source.uriObj.path,
headers: source.allHeaders
headers: source.allHeaders,
};
code.push('var http = require("%s");', source.uriObj.protocol.replace(':', ''));
@@ -58,8 +58,8 @@ module.exports = function(source, options) {
code.push(
'req.write(qs.stringify(%s));',
util.inspect(source.postData.paramsObj, {
depth: null
})
depth: null,
}),
);
}
break;
@@ -69,8 +69,8 @@ module.exports = function(source, options) {
code.push(
'req.write(JSON.stringify(%s));',
util.inspect(source.postData.jsonObj, {
depth: null
})
depth: null,
}),
);
}
break;
@@ -90,5 +90,5 @@ module.exports.info = {
key: 'native',
title: 'HTTP',
link: 'http://nodejs.org/api/http.html#http_http_request_options_callback',
description: 'Node.js native HTTP interface'
description: 'Node.js native HTTP interface',
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var includeFS = false;
@@ -28,7 +28,7 @@ module.exports = function(source, options) {
var reqOpts = {
method: source.method,
url: source.url
url: source.url,
};
if (Object.keys(source.queryObj).length) {
@@ -73,7 +73,7 @@ module.exports = function(source, options) {
if (param.fileName) {
attachement.options = {
filename: param.fileName,
contentType: param.contentType ? param.contentType : null
contentType: param.contentType ? param.contentType : null,
};
}
@@ -100,7 +100,7 @@ module.exports = function(source, options) {
'jar.setCookie(request.cookie("%s=%s"), "%s");',
encodeURIComponent(cookie.name),
encodeURIComponent(cookie.value),
url
url,
);
});
code.blank();
@@ -131,5 +131,5 @@ module.exports.info = {
key: 'request',
title: 'Request',
link: 'https://github.com/request/request',
description: 'Simplified HTTP request client'
description: 'Simplified HTTP request client',
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var includeFS = false;
@@ -38,7 +38,7 @@ module.exports = function(source, options) {
'CookieJar.add("%s=%s","%s");',
encodeURIComponent(cookie.name),
encodeURIComponent(cookie.value),
source.url
source.url,
);
});
@@ -98,7 +98,7 @@ module.exports = function(source, options) {
if (source.postData.text) {
code.push(
opts.indent + 'req.send(%s);',
JSON.stringify(source.postData.text, null, opts.indent)
JSON.stringify(source.postData.text, null, opts.indent),
);
}
}
@@ -125,5 +125,5 @@ module.exports.info = {
key: 'unirest',
title: 'Unirest',
link: 'http://unirest.io/nodejs.html',
description: 'Lightweight HTTP Request Client Library'
description: 'Lightweight HTTP Request Client Library',
};
@@ -56,7 +56,7 @@ module.exports = {
var values_representation = value.map(
function(v) {
return this.literalRepresentation(v);
}.bind(this)
}.bind(this),
);
return '@[ ' + values_representation.join(join) + ' ]';
case '[object Object]':
@@ -70,5 +70,5 @@ module.exports = {
default:
return '@"' + value.toString().replace(/"/g, '\\"') + '"';
}
}
},
};
@@ -5,8 +5,8 @@ module.exports = {
key: 'objc',
title: 'Objective-C',
extname: '.m',
default: 'nsurlsession'
default: 'nsurlsession',
},
nsurlsession: require('./nsurlsession')
nsurlsession: require('./nsurlsession'),
};
@@ -19,16 +19,16 @@ module.exports = function(source, options) {
{
indent: ' ',
pretty: true,
timeout: '10'
timeout: '10',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
// Markers for headers to be created as litteral objects and later be set on the NSURLRequest if exist
var req = {
hasHeaders: false,
hasBody: false
hasBody: false,
};
// We just want to make sure people understand that is the only dependency
@@ -54,13 +54,13 @@ module.exports = function(source, options) {
.push(
'NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"%s=%s" dataUsingEncoding:NSUTF8StringEncoding]];',
source.postData.params[0].name,
source.postData.params[0].value
source.postData.params[0].value,
);
for (var i = 1, len = source.postData.params.length; i < len; i++) {
code.push(
'[postData appendData:[@"&%s=%s" dataUsingEncoding:NSUTF8StringEncoding]];',
source.postData.params[i].name,
source.postData.params[i].value
source.postData.params[i].value,
);
}
break;
@@ -73,12 +73,12 @@ module.exports = function(source, options) {
'NSDictionary',
'parameters',
source.postData.jsonObj,
opts.pretty
)
opts.pretty,
),
)
.blank()
.push(
'NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];'
'NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];',
);
}
break;
@@ -98,12 +98,12 @@ module.exports = function(source, options) {
.push(1, 'if (param[@"fileName"]) {')
.push(
2,
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];'
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',
)
.push(2, '[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];')
.push(
2,
'[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];'
'[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',
)
.push(2, 'if (error) {')
.push(3, 'NSLog(@"%@", error);')
@@ -111,7 +111,7 @@ module.exports = function(source, options) {
.push(1, '} else {')
.push(
2,
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];'
'[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];',
)
.push(2, '[body appendFormat:@"%@", param[@"value"]];')
.push(1, '}')
@@ -126,7 +126,7 @@ module.exports = function(source, options) {
.push(
'NSData *postData = [[NSData alloc] initWithData:[@"' +
source.postData.text +
'" dataUsingEncoding:NSUTF8StringEncoding]];'
'" dataUsingEncoding:NSUTF8StringEncoding]];',
);
}
}
@@ -136,16 +136,16 @@ module.exports = function(source, options) {
.push(
'NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"' +
source.fullUrl +
'"]'
'"]',
)
// NSURLRequestUseProtocolCachePolicy is the default policy, let's just always set it to avoid confusion.
.push(
' cachePolicy:NSURLRequestUseProtocolCachePolicy'
' cachePolicy:NSURLRequestUseProtocolCachePolicy',
)
.push(
' timeoutInterval:' +
parseInt(opts.timeout, 10).toFixed(1) +
'];'
'];',
)
.push('[request setHTTPMethod:@"' + source.method + '"];');
@@ -163,7 +163,7 @@ module.exports = function(source, options) {
.push('NSURLSession *session = [NSURLSession sharedSession];')
.push('NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request')
.push(
' completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {'
' completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {',
)
.push(1, ' if (error) {')
.push(2, ' NSLog(@"%@", error);')
@@ -171,7 +171,7 @@ module.exports = function(source, options) {
// Casting the NSURLResponse to NSHTTPURLResponse so the user can see the status .
.push(
2,
' NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;'
' NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;',
)
.push(2, ' NSLog(@"%@", httpResponse);')
.push(1, ' }')
@@ -186,5 +186,5 @@ module.exports.info = {
title: 'NSURLSession',
link:
'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',
description: "Foundation's NSURLSession request"
description: "Foundation's NSURLSession request",
};
@@ -16,9 +16,9 @@ var CodeBuilder = require('../../helpers/code-builder');
module.exports = function(source, options) {
var opts = util._extend(
{
indent: ' '
indent: ' ',
},
options
options,
);
var methods = ['get', 'post', 'head', 'delete', 'patch', 'put', 'options'];
@@ -38,7 +38,7 @@ module.exports = function(source, options) {
code.push(
'let headers = Header.add (Header.init ()) "%s" "%s" in',
headers[0],
source.allHeaders[headers[0]]
source.allHeaders[headers[0]],
);
} else if (headers.length > 1) {
code.push('let headers = Header.add_list (Header.init ()) [');
@@ -65,7 +65,7 @@ module.exports = function(source, options) {
source.postData.text ? '~body ' : '',
methods.indexOf(source.method.toLowerCase()) >= 0
? '`' + source.method.toUpperCase()
: '(Code.method_of_string "' + source.method + '")'
: '(Code.method_of_string "' + source.method + '")',
);
// Catch result
@@ -78,5 +78,5 @@ module.exports.info = {
key: 'cohttp',
title: 'CoHTTP',
link: 'https://github.com/mirage/ocaml-cohttp',
description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml'
description: 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml',
};
@@ -5,8 +5,8 @@ module.exports = {
key: 'ocaml',
title: 'OCaml',
extname: '.ml',
default: 'cohttp'
default: 'cohttp',
},
cohttp: require('./cohttp')
cohttp: require('./cohttp'),
};
@@ -22,9 +22,9 @@ module.exports = function(source, options) {
namedErrors: false,
noTags: false,
shortTags: false,
timeout: 30
timeout: 30,
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -39,48 +39,48 @@ module.exports = function(source, options) {
{
escape: true,
name: 'CURLOPT_PORT',
value: source.uriObj.port
value: source.uriObj.port,
},
{
escape: true,
name: 'CURLOPT_URL',
value: source.fullUrl
value: source.fullUrl,
},
{
escape: false,
name: 'CURLOPT_RETURNTRANSFER',
value: 'true'
value: 'true',
},
{
escape: true,
name: 'CURLOPT_ENCODING',
value: ''
value: '',
},
{
escape: false,
name: 'CURLOPT_MAXREDIRS',
value: opts.maxRedirects
value: opts.maxRedirects,
},
{
escape: false,
name: 'CURLOPT_TIMEOUT',
value: opts.timeout
value: opts.timeout,
},
{
escape: false,
name: 'CURLOPT_HTTP_VERSION',
value: source.httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1'
value: source.httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1',
},
{
escape: true,
name: 'CURLOPT_CUSTOMREQUEST',
value: source.method
value: source.method,
},
{
escape: true,
name: 'CURLOPT_POSTFIELDS',
value: source.postData ? source.postData.text : undefined
}
value: source.postData ? source.postData.text : undefined,
},
];
code.push('curl_setopt_array($curl, array(');
@@ -93,8 +93,8 @@ module.exports = function(source, options) {
util.format(
'%s => %s,',
option.name,
option.escape ? JSON.stringify(option.value) : option.value
)
option.escape ? JSON.stringify(option.value) : option.value,
),
);
}
});
@@ -155,5 +155,5 @@ module.exports.info = {
key: 'curl',
title: 'cURL',
link: 'http://php.net/manual/en/book.curl.php',
description: 'PHP with ext-curl'
description: 'PHP with ext-curl',
};
@@ -80,6 +80,6 @@ module.exports = {
'UNCHECKOUT',
'UNLOCK',
'UPDATE',
'VERSION_CONTROL'
]
'VERSION_CONTROL',
],
};
@@ -20,9 +20,9 @@ module.exports = function(source, options) {
closingTag: false,
indent: ' ',
noTags: false,
shortTags: false
shortTags: false,
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -65,7 +65,7 @@ module.exports = function(source, options) {
.push('$request->setContentType(%s);', helpers.convert(source.postData.mimeType))
.push(
'$request->setPostFields(%s);',
helpers.convert(source.postData.paramsObj, opts.indent)
helpers.convert(source.postData.paramsObj, opts.indent),
)
.blank();
break;
@@ -96,5 +96,5 @@ module.exports.info = {
key: 'http1',
title: 'HTTP v1',
link: 'http://php.net/manual/en/book.http.php',
description: 'PHP with pecl/http v1'
description: 'PHP with pecl/http v1',
};
@@ -20,9 +20,9 @@ module.exports = function(source, options) {
closingTag: false,
indent: ' ',
noTags: false,
shortTags: false
shortTags: false,
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -43,7 +43,7 @@ module.exports = function(source, options) {
.push('$body = new http\\Message\\Body;')
.push(
'$body->append(new http\\QueryString(%s));',
helpers.convert(source.postData.paramsObj, opts.indent)
helpers.convert(source.postData.paramsObj, opts.indent),
)
.blank();
hasBody = true;
@@ -59,7 +59,7 @@ module.exports = function(source, options) {
name: param.name,
type: param.contentType,
file: param.fileName,
data: param.value
data: param.value,
});
} else if (param.value) {
fields[param.name] = param.value;
@@ -71,7 +71,7 @@ module.exports = function(source, options) {
.push(
'$body->addForm(%s, %s);',
Object.keys(fields).length ? helpers.convert(fields, opts.indent) : 'NULL',
files.length ? helpers.convert(files, opts.indent) : 'NULL'
files.length ? helpers.convert(files, opts.indent) : 'NULL',
);
// remove the contentType header
@@ -106,7 +106,7 @@ module.exports = function(source, options) {
code
.push(
'$request->setQuery(new http\\QueryString(%s));',
helpers.convert(source.queryObj, opts.indent)
helpers.convert(source.queryObj, opts.indent),
)
.blank();
}
@@ -139,5 +139,5 @@ module.exports.info = {
key: 'http2',
title: 'HTTP v2',
link: 'http://devel-m6w6.rhcloud.com/mdref/http',
description: 'PHP with pecl/http v2'
description: 'PHP with pecl/http v2',
};
@@ -5,10 +5,10 @@ module.exports = {
key: 'php',
title: 'PHP',
extname: '.php',
default: 'curl'
default: 'curl',
},
curl: require('./curl'),
http1: require('./http1'),
http2: require('./http2')
http2: require('./http2'),
};
@@ -5,9 +5,9 @@ module.exports = {
key: 'python',
title: 'Python',
extname: '.py',
default: 'python3'
default: 'python3',
},
python3: require('./python3'),
requests: require('./requests')
requests: require('./requests'),
};
@@ -83,5 +83,5 @@ module.exports.info = {
key: 'python3',
title: 'http.client',
link: 'https://docs.python.org/3/library/http.client.html',
description: 'Python3 HTTP Client'
description: 'Python3 HTTP Client',
};
@@ -94,7 +94,7 @@ module.exports.info = {
key: 'requests',
title: 'Requests',
link: 'http://docs.python-requests.org/en/latest/api/#requests.request',
description: 'Requests HTTP library'
description: 'Requests HTTP library',
};
// response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
@@ -5,8 +5,8 @@ module.exports = {
key: 'ruby',
title: 'Ruby',
extname: '.rb',
default: 'native'
default: 'native',
},
native: require('./native')
native: require('./native'),
};
@@ -25,7 +25,7 @@ module.exports = function(source, options) {
'LOCK',
'UNLOCK',
'MOVE',
'TRACE'
'TRACE',
];
var capMethod = method.charAt(0) + method.substring(1).toLowerCase();
if (methods.indexOf(method) < 0) {
@@ -72,5 +72,5 @@ module.exports.info = {
key: 'native',
title: 'net::http',
link: 'http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html',
description: 'Ruby HTTP client'
description: 'Ruby HTTP client',
};
@@ -19,9 +19,9 @@ module.exports = function(source, options) {
{
indent: ' ',
short: false,
binary: false
binary: false,
},
options
options,
);
var code = new CodeBuilder(opts.indent, opts.indent !== false ? ' \\\n' + opts.indent : ' ');
@@ -73,7 +73,7 @@ module.exports = function(source, options) {
code.push(
'%s %s',
opts.binary ? '--data-binary' : opts.short ? '-d' : '--data',
helpers.quote(source.postData.text)
helpers.quote(source.postData.text),
);
}
}
@@ -85,5 +85,5 @@ module.exports.info = {
key: 'curl',
title: 'cURL',
link: 'http://curl.haxx.se/',
description: 'cURL is a command line tool and library for transferring data with URL syntax'
description: 'cURL is a command line tool and library for transferring data with URL syntax',
};
@@ -28,9 +28,9 @@ module.exports = function(source, options) {
style: false,
timeout: false,
verbose: false,
verify: false
verify: false,
},
options
options,
);
var code = new CodeBuilder(opts.indent, opts.indent !== false ? ' \\\n' + opts.indent : ' ');
@@ -115,7 +115,7 @@ module.exports = function(source, options) {
'http %s%s %s',
flags.length ? flags.join(' ') + ' ' : '',
source.method,
shell.quote(opts.queryParams ? source.url : source.fullUrl)
shell.quote(opts.queryParams ? source.url : source.fullUrl),
);
if (raw && source.postData.text) {
@@ -129,5 +129,5 @@ module.exports.info = {
key: 'httpie',
title: 'HTTPie',
link: 'http://httpie.org/',
description: 'a CLI, cURL-like tool for humans'
description: 'a CLI, cURL-like tool for humans',
};
@@ -5,10 +5,10 @@ module.exports = {
key: 'shell',
title: 'Shell',
extname: '.sh',
default: 'curl'
default: 'curl',
},
curl: require('./curl'),
httpie: require('./httpie'),
wget: require('./wget')
wget: require('./wget'),
};
@@ -19,9 +19,9 @@ module.exports = function(source, options) {
{
indent: ' ',
short: false,
verbose: false
verbose: false,
},
options
options,
);
var code = new CodeBuilder(opts.indent, opts.indent !== false ? ' \\\n' + opts.indent : ' ');
@@ -52,5 +52,5 @@ module.exports.info = {
key: 'wget',
title: 'Wget',
link: 'https://www.gnu.org/software/wget/',
description: 'a free software package for retrieving files using HTTP, HTTPS'
description: 'a free software package for retrieving files using HTTP, HTTPS',
};
@@ -66,26 +66,26 @@ module.exports = {
pretty = Object.keys(v).length > 1;
}
return this.literalRepresentation(v, opts, indentLevel);
}.bind(this)
}.bind(this),
);
return concatArray(valuesRepresentation, pretty, opts.indent, indentLevel);
case '[object Object]':
var keyValuePairs = [];
for (var k in value) {
keyValuePairs.push(
util.format('"%s": %s', k, this.literalRepresentation(value[k], opts, indentLevel))
util.format('"%s": %s', k, this.literalRepresentation(value[k], opts, indentLevel)),
);
}
return concatArray(
keyValuePairs,
opts.pretty && keyValuePairs.length > 1,
opts.indent,
indentLevel
indentLevel,
);
case '[object Boolean]':
return value.toString();
default:
return '"' + value.toString().replace(/"/g, '\\"') + '"';
}
}
},
};
@@ -5,8 +5,8 @@ module.exports = {
key: 'swift',
title: 'Swift',
extname: '.swift',
default: 'nsurlsession'
default: 'nsurlsession',
},
nsurlsession: require('./nsurlsession')
nsurlsession: require('./nsurlsession'),
};
@@ -19,9 +19,9 @@ module.exports = function(source, options) {
{
indent: ' ',
pretty: true,
timeout: '10'
timeout: '10',
},
options
options,
);
var code = new CodeBuilder(opts.indent);
@@ -29,7 +29,7 @@ module.exports = function(source, options) {
// Markers for headers to be created as litteral objects and later be set on the NSURLRequest if exist
var req = {
hasHeaders: false,
hasBody: false
hasBody: false,
};
// We just want to make sure people understand that is the only dependency
@@ -53,13 +53,13 @@ module.exports = function(source, options) {
.push(
'let postData = NSMutableData(data: "%s=%s".data(using: String.Encoding.utf8)!)',
source.postData.params[0].name,
source.postData.params[0].value
source.postData.params[0].value,
);
for (var i = 1, len = source.postData.params.length; i < len; i++) {
code.push(
'postData.append("&%s=%s".data(using: String.Encoding.utf8)!)',
source.postData.params[i].name,
source.postData.params[i].value
source.postData.params[i].value,
);
}
break;
@@ -69,7 +69,7 @@ module.exports = function(source, options) {
code
.push(
helpers.literalDeclaration('parameters', source.postData.jsonObj, opts),
'as [String : Any]'
'as [String : Any]',
)
.blank()
.push('let postData = JSONSerialization.data(withJSONObject: parameters, options: [])');
@@ -97,7 +97,7 @@ module.exports = function(source, options) {
.push(2, 'let contentType = param["content-type"]!')
.push(
2,
'let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)'
'let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)',
)
.push(2, 'if (error != nil) {')
.push(3, 'print(error)')
@@ -116,7 +116,7 @@ module.exports = function(source, options) {
.blank()
.push(
'let postData = NSData(data: "%s".data(using: String.Encoding.utf8)!)',
source.postData.text
source.postData.text,
);
}
}
@@ -128,7 +128,7 @@ module.exports = function(source, options) {
.push(' cachePolicy: .useProtocolCachePolicy,')
.push(
' timeoutInterval: %s)',
parseInt(opts.timeout, 10).toFixed(1)
parseInt(opts.timeout, 10).toFixed(1),
)
.push('request.httpMethod = "%s"', source.method);
@@ -145,7 +145,7 @@ module.exports = function(source, options) {
// Retrieving the shared session will be less verbose than creating a new one.
.push('let session = URLSession.shared')
.push(
'let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in'
'let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in',
)
.push(1, 'if (error != nil) {')
.push(2, 'print(error)')
@@ -166,5 +166,5 @@ module.exports.info = {
title: 'NSURLSession',
link:
'https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html',
description: "Foundation's NSURLSession request"
description: "Foundation's NSURLSession request",
};