fix(core): update
This commit is contained in:
parent
92059a50de
commit
d182832e47
@ -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
|
||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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 () => {
|
||||
|
@ -70,15 +70,15 @@ 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 = '';
|
||||
@ -87,10 +87,11 @@ export const postFormDataUrlEncoded = async (
|
||||
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;
|
||||
|
@ -5,5 +5,5 @@ export interface ISmartRequestOptions extends https.RequestOptions {
|
||||
keepAlive?: boolean;
|
||||
requestBody?: any;
|
||||
autoJsonParse?: boolean;
|
||||
queryParams?: {[key: string]: string}
|
||||
queryParams?: { [key: string]: string };
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user