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