From d182832e4724690a25b34417a9874a1bdd8901e1 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Tue, 15 Feb 2022 18:57:42 +0100 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 4 ++++ .vscode/launch.json | 24 +++--------------------- npmextra.json | 2 +- package.json | 2 +- test/test.ts | 2 +- ts/smartrequest.formdata.ts | 13 +++++++------ ts/smartrequest.interfaces.ts | 2 +- ts/smartrequest.request.ts | 2 +- 8 files changed, 19 insertions(+), 32 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..a70f7eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ stages: - release - metadata +before_script: + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== @@ -36,6 +39,7 @@ auditProductionDependencies: - npmci command npm audit --audit-level=high --only=prod --production tags: - docker + allow_failure: true auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci diff --git a/.vscode/launch.json b/.vscode/launch.json index 112db52..26e9f92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,28 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "current file", - "type": "node", + "command": "npm test", + "name": "Run npm test", "request": "launch", - "args": [ - "${relativeFile}" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" - }, - { - "name": "test.ts", - "type": "node", - "request": "launch", - "args": [ - "test/test.ts" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" + "type": "node-terminal" } ] } diff --git a/npmextra.json b/npmextra.json index e9e658a..d75800d 100644 --- a/npmextra.json +++ b/npmextra.json @@ -12,7 +12,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartrequest", - "shortDescription": "dropin replacement for request", + "description": "dropin replacement for request", "npmPackagename": "@pushrocks/smartrequest", "license": "MIT" } diff --git a/package.json b/package.json index e1fb940..12c3661 100644 --- a/package.json +++ b/package.json @@ -52,4 +52,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 219648c..9b0f4a3 100644 --- a/test/test.ts +++ b/test/test.ts @@ -3,7 +3,7 @@ import { tap, expect, expectAsync } from '@pushrocks/tapbundle'; import * as smartrequest from '../ts/index'; tap.test('should request a html document over https', async () => { - await expectAsync(smartrequest.getJson('https://encrypted.google.com/')).toHaveProperty('body') + await expectAsync(smartrequest.getJson('https://encrypted.google.com/')).toHaveProperty('body'); }); tap.test('should request a JSON document over https', async () => { diff --git a/ts/smartrequest.formdata.ts b/ts/smartrequest.formdata.ts index 0972a37..84130b7 100644 --- a/ts/smartrequest.formdata.ts +++ b/ts/smartrequest.formdata.ts @@ -70,27 +70,28 @@ export const postFormData = async ( export const postFormDataUrlEncoded = async ( urlArg: string, optionsArg: interfaces.ISmartRequestOptions = {}, - payloadArg: {key: string, content: string}[] + payloadArg: { key: string; content: string }[] ) => { const requestOptions = { ...optionsArg, method: 'POST', headers: { ...optionsArg.headers, - 'content-type': 'application/x-www-form-urlencoded' - } + 'content-type': 'application/x-www-form-urlencoded', + }, }; - let resultString = ''; + let resultString = ''; for (const keyContentPair of payloadArg) { if (resultString) { resultString += '&'; } - resultString += `${encodeURIComponent(keyContentPair.key)}=${encodeURIComponent(keyContentPair.content)}`; + resultString += `${encodeURIComponent(keyContentPair.key)}=${encodeURIComponent( + keyContentPair.content + )}`; } - // lets fire the actual request for sending the formdata const response = await request(urlArg + resultString, requestOptions); return response; diff --git a/ts/smartrequest.interfaces.ts b/ts/smartrequest.interfaces.ts index ad5ba95..e9be9c6 100644 --- a/ts/smartrequest.interfaces.ts +++ b/ts/smartrequest.interfaces.ts @@ -5,5 +5,5 @@ export interface ISmartRequestOptions extends https.RequestOptions { keepAlive?: boolean; requestBody?: any; autoJsonParse?: boolean; - queryParams?: {[key: string]: string} + queryParams?: { [key: string]: string }; } diff --git a/ts/smartrequest.request.ts b/ts/smartrequest.request.ts index 1e8c8e8..5d01e24 100644 --- a/ts/smartrequest.request.ts +++ b/ts/smartrequest.request.ts @@ -104,7 +104,7 @@ export let request = async ( // parse url const parsedUrl = plugins.smarturl.Smarturl.createFromUrl(urlArg, { - searchParams: optionsArg.queryParams || {} + searchParams: optionsArg.queryParams || {}, }); optionsArg.hostname = parsedUrl.hostname; if (parsedUrl.port) {