🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@testring/http-api

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testring/http-api - npm Package Compare versions

Comparing version
0.4.23
to
0.4.24
+16
-0
dist/http-server.js

@@ -26,4 +26,8 @@ "use strict";

this.isBusy = false;
this.isKilled = false;
this.registerTransportListener();
}
kill() {
this.isKilled = true;
}
get logger() {

@@ -44,2 +48,5 @@ if (this._logger) {

return __awaiter(this, void 0, void 0, function* () {
if (this.isKilled) {
return;
}
let uid;

@@ -56,2 +63,5 @@ try {

}
if (this.isKilled) {
return;
}
this.logger.verbose(`Successful response form ${request.url}`);

@@ -66,2 +76,5 @@ const responseAfterHook = yield this.callHook("beforeResponse" /* beforeResponse */, response, data);

catch (error) {
if (this.isKilled) {
return;
}
const errorAfterHook = yield this.callHook("beforeError" /* beforeError */, error, data);

@@ -109,2 +122,5 @@ yield this.send(src, "rejectHttpRequest" /* reject */, {

this.transportInstance.on("sendHttpRequest" /* send */, (data, src) => {
if (this.isKilled) {
return;
}
// todo validate data

@@ -111,0 +127,0 @@ if (this.isBusy) {

+6
-6
{
"name": "@testring/http-api",
"version": "0.4.23",
"version": "0.4.24",
"main": "./dist/index.js",

@@ -13,7 +13,7 @@ "types": "./src/index.ts",

"dependencies": {
"@testring/logger": "0.4.23",
"@testring/pluggable-module": "0.4.23",
"@testring/test-utils": "0.4.23",
"@testring/transport": "0.4.23",
"@testring/types": "0.4.23",
"@testring/logger": "0.4.24",
"@testring/pluggable-module": "0.4.24",
"@testring/test-utils": "0.4.24",
"@testring/transport": "0.4.24",
"@testring/types": "0.4.24",
"@types/nanoid": "^1.0.0",

@@ -20,0 +20,0 @@ "@types/request-promise": "^4.1.42",

@@ -28,2 +28,4 @@ import { IHttpRequest, IHttpResponse } from '@testring/types';

private isKilled = false;
constructor(

@@ -42,2 +44,6 @@ private transportInstance: ITransport,

public kill() {
this.isKilled = true;
}
private get logger(): LoggerClientLocal {

@@ -61,4 +67,9 @@ if (this._logger) {

private async makeRequest(data, src): Promise<any> {
private async makeRequest(data, src): Promise<void> {
if (this.isKilled) {
return;
}
let uid;
try {

@@ -78,2 +89,6 @@ uid = data.uid;

if (this.isKilled) {
return;
}
this.logger.verbose(`Successful response form ${request.url}`);

@@ -87,4 +102,9 @@

});
this.setTimer();
} catch (error) {
if (this.isKilled) {
return;
}
const errorAfterHook = await this.callHook(HttpServerPlugins.beforeError, error, data);

@@ -133,2 +153,5 @@

this.transportInstance.on(HttpMessageType.send, (data: IHttpRequestMessage, src: string) => {
if (this.isKilled) {
return;
}

@@ -135,0 +158,0 @@ // todo validate data