Comparing version 4.2.4 to 4.2.5
@@ -32,6 +32,9 @@ "use strict"; | ||
var requestOptions = __assign({}, options, { headers: headers, method: req.method }); | ||
return new Promise(function (resolve) { | ||
return new Promise(function (resolve, reject) { | ||
var clientRequest = http.request(requestOptions, function (res) { | ||
return resolve(Res_1.ResOf(res.statusCode, res, res.headers)); | ||
}); | ||
clientRequest.on('error', function (err) { | ||
reject(err); | ||
}); | ||
if (req.bodyStream()) { | ||
@@ -38,0 +41,0 @@ req.bodyStream().pipe(clientRequest); |
@@ -31,6 +31,9 @@ import * as http from "http"; | ||
return new Promise(resolve => { | ||
return new Promise((resolve, reject) => { | ||
const clientRequest = http.request(requestOptions, (res: IncomingMessage) => { | ||
return resolve(ResOf(res.statusCode, res, res.headers as HeadersJson)); | ||
}); | ||
clientRequest.on('error', (err) => { | ||
reject(err); | ||
}); | ||
if (req.bodyStream()){ | ||
@@ -37,0 +40,0 @@ req.bodyStream()!.pipe(clientRequest); |
@@ -20,3 +20,3 @@ /// <reference types="node" /> | ||
bodyStream(): Readable | undefined; | ||
bigBodyString(): Promise<string>; | ||
fullBodyString(): Promise<string>; | ||
static OK(body: BodyContent, headers?: {}): Res; | ||
@@ -23,0 +23,0 @@ static Created(body: BodyContent, headers?: {}): Res; |
@@ -82,3 +82,3 @@ "use strict"; | ||
}; | ||
Res.prototype.bigBodyString = function () { | ||
Res.prototype.fullBodyString = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -85,0 +85,0 @@ return __generator(this, function (_a) { |
@@ -59,3 +59,3 @@ import {BodyContent, HeadersJson, HttpMessage} from "./HttpMessage"; | ||
async bigBodyString(): Promise<string> { | ||
async fullBodyString(): Promise<string> { | ||
return this.body.fullBodyString(); | ||
@@ -62,0 +62,0 @@ } |
{ | ||
"name": "http4js", | ||
"version": "4.2.4", | ||
"version": "4.2.5", | ||
"description": "A lightweight HTTP toolkit", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
138508
3115
5