fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-29 16:42:56 +02:00
parent 36472b7306
commit 6e31d84798
5 changed files with 14 additions and 11 deletions

View File

@ -54,7 +54,7 @@ testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
@ -65,7 +65,7 @@ testBuild:
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
@ -81,6 +81,7 @@ codequality:
allow_failure: true allow_failure: true
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:

View File

@ -13,7 +13,9 @@ export interface IFormField {
const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => { const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => {
if (formDataField.type === 'filePath') { 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, { formDataArg.append('file', fileData, {
filename: 'upload.pdf', filename: 'upload.pdf',
contentType: 'application/pdf' contentType: 'application/pdf'
@ -30,13 +32,15 @@ export const postFormData = async (
for (const formField of payloadArg) { for (const formField of payloadArg) {
await appendFormField(form, formField); await appendFormField(form, formField);
} }
const requestOptions = {...optionsArg, const requestOptions = {
...optionsArg,
method: 'POST', method: 'POST',
headers: { headers: {
...optionsArg.headers, ...optionsArg.headers,
...form.getHeaders() ...form.getHeaders()
}, },
requestBody: form}; requestBody: form
};
// lets fire the actual request for sending the formdata // lets fire the actual request for sending the formdata
const response = await request(urlArg, requestOptions); const response = await request(urlArg, requestOptions);

View File

@ -12,6 +12,4 @@ export { formData, http, https, fs, path, url, smartpromise };
// third party scope // third party scope
import * as agentkeepalive from 'agentkeepalive'; import * as agentkeepalive from 'agentkeepalive';
export { export { agentkeepalive };
agentkeepalive
};

View File

@ -125,13 +125,13 @@ export let request = async (
case parsedUrl.protocol === 'https:' && optionsArg.keepAlive: case parsedUrl.protocol === 'https:' && optionsArg.keepAlive:
optionsArg.agent = httpsAgent; optionsArg.agent = httpsAgent;
return plugins.https; return plugins.https;
case parsedUrl.protocol === 'https:' && (!optionsArg.keepAlive): case parsedUrl.protocol === 'https:' && !optionsArg.keepAlive:
optionsArg.agent = httpsAgentKeepAliveFalse; optionsArg.agent = httpsAgentKeepAliveFalse;
return plugins.https; return plugins.https;
case parsedUrl.protocol === 'http:' && optionsArg.keepAlive: case parsedUrl.protocol === 'http:' && optionsArg.keepAlive:
optionsArg.agent = httpAgent; optionsArg.agent = httpAgent;
return plugins.http; return plugins.http;
case parsedUrl.protocol === 'http:' && (!optionsArg.keepAlive): case parsedUrl.protocol === 'http:' && !optionsArg.keepAlive:
optionsArg.agent = httpAgentKeepAliveFalse; optionsArg.agent = httpAgentKeepAliveFalse;
return plugins.http; return plugins.http;
} }