indent code
This commit is contained in:
parent
2ef0f378d7
commit
bf2cfe0735
@ -12,7 +12,7 @@ let buildResponse = (responseArg): Promise<any> => {
|
||||
responseArg.on('end', function () {
|
||||
try {
|
||||
responseArg.body = JSON.parse(body);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
responseArg.body = body
|
||||
}
|
||||
done.resolve(responseArg)
|
||||
@ -26,7 +26,7 @@ export let request = async (domainArg: string, optionsArg: interfaces.ISmartRequ
|
||||
if (domainArg) {
|
||||
parsedUrl = plugins.url.parse(domainArg)
|
||||
optionsArg.hostname = parsedUrl.hostname
|
||||
if(parsedUrl.port) { optionsArg.port = parseInt(parsedUrl.port) }
|
||||
if (parsedUrl.port) { optionsArg.port = parseInt(parsedUrl.port) }
|
||||
optionsArg.path = parsedUrl.path
|
||||
}
|
||||
if (!parsedUrl || parsedUrl.protocol === 'https:') {
|
||||
@ -38,7 +38,7 @@ export let request = async (domainArg: string, optionsArg: interfaces.ISmartRequ
|
||||
}
|
||||
})
|
||||
if (optionsArg.requestBody) {
|
||||
if(typeof optionsArg.requestBody !== 'string') {
|
||||
if (typeof optionsArg.requestBody !== 'string') {
|
||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody)
|
||||
}
|
||||
request.write(optionsArg.requestBody)
|
||||
@ -56,7 +56,7 @@ export let request = async (domainArg: string, optionsArg: interfaces.ISmartRequ
|
||||
}
|
||||
})
|
||||
if (optionsArg.requestBody) {
|
||||
if(typeof optionsArg.requestBody !== 'string') {
|
||||
if (typeof optionsArg.requestBody !== 'string') {
|
||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody)
|
||||
}
|
||||
request.write(optionsArg.requestBody)
|
||||
|
Loading…
Reference in New Issue
Block a user