diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e3250b..0b92fd3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,7 +54,7 @@ testBuild: stage: test script: - npmci npm prepare - - npmci node install lts + - npmci node install stable - npmci npm install - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ @@ -65,7 +65,7 @@ testBuild: release: stage: release script: - - npmci node install lts + - npmci node install stable - npmci npm publish only: - tags @@ -81,6 +81,7 @@ codequality: allow_failure: true script: - npmci command npm install -g tslint typescript + - npmci npm prepare - npmci npm install - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: diff --git a/package.json b/package.json index a5c28a0..20a004d 100644 --- a/package.json +++ b/package.json @@ -48,4 +48,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/ts/smartrequest.formdata.ts b/ts/smartrequest.formdata.ts index 0359d99..5d0a806 100644 --- a/ts/smartrequest.formdata.ts +++ b/ts/smartrequest.formdata.ts @@ -13,7 +13,9 @@ export interface IFormField { const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => { if (formDataField.type === 'filePath') { - const fileData = plugins.fs.readFileSync(plugins.path.join(process.cwd(), formDataField.payload)); + const fileData = plugins.fs.readFileSync( + plugins.path.join(process.cwd(), formDataField.payload) + ); formDataArg.append('file', fileData, { filename: 'upload.pdf', contentType: 'application/pdf' @@ -30,13 +32,15 @@ export const postFormData = async ( for (const formField of payloadArg) { await appendFormField(form, formField); } - const requestOptions = {...optionsArg, + const requestOptions = { + ...optionsArg, method: 'POST', headers: { ...optionsArg.headers, ...form.getHeaders() }, - requestBody: form}; + requestBody: form + }; // lets fire the actual request for sending the formdata const response = await request(urlArg, requestOptions); diff --git a/ts/smartrequest.plugins.ts b/ts/smartrequest.plugins.ts index 54e61b9..a88e975 100644 --- a/ts/smartrequest.plugins.ts +++ b/ts/smartrequest.plugins.ts @@ -12,6 +12,4 @@ export { formData, http, https, fs, path, url, smartpromise }; // third party scope import * as agentkeepalive from 'agentkeepalive'; -export { - agentkeepalive -}; +export { agentkeepalive }; diff --git a/ts/smartrequest.request.ts b/ts/smartrequest.request.ts index a8e63f5..be2cb7a 100644 --- a/ts/smartrequest.request.ts +++ b/ts/smartrequest.request.ts @@ -125,13 +125,13 @@ export let request = async ( case parsedUrl.protocol === 'https:' && optionsArg.keepAlive: optionsArg.agent = httpsAgent; return plugins.https; - case parsedUrl.protocol === 'https:' && (!optionsArg.keepAlive): + case parsedUrl.protocol === 'https:' && !optionsArg.keepAlive: optionsArg.agent = httpsAgentKeepAliveFalse; return plugins.https; case parsedUrl.protocol === 'http:' && optionsArg.keepAlive: optionsArg.agent = httpAgent; return plugins.http; - case parsedUrl.protocol === 'http:' && (!optionsArg.keepAlive): + case parsedUrl.protocol === 'http:' && !optionsArg.keepAlive: optionsArg.agent = httpAgentKeepAliveFalse; return plugins.http; }