@push-rpc/next
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -6,2 +6,3 @@ "use strict"; | ||
const logger_js_1 = require("../logger.js"); | ||
const server_1 = require("../utils/server"); | ||
async function serveHttpRequest(req, res, path, hooks, createConnectionContext) { | ||
@@ -75,11 +76,12 @@ // if port is in options - response 404 on other URLs | ||
function readBody(req) { | ||
const decompressed = (0, server_1.decompressRequest)(req); | ||
return new Promise((resolve, reject) => { | ||
let body = ""; | ||
req.on("data", (chunk) => { | ||
decompressed.on("data", (chunk) => { | ||
body += chunk.toString(); | ||
}); | ||
req.on("end", () => { | ||
decompressed.on("end", () => { | ||
resolve(body); | ||
}); | ||
req.on("error", (error) => { | ||
decompressed.on("error", (error) => { | ||
reject(error); | ||
@@ -86,0 +88,0 @@ }); |
{ | ||
"name": "@push-rpc/next", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -31,2 +31,6 @@ ## Glossary | ||
- [important] Importing index.js from the root of the package will import node's http package. Not good for clients. | ||
- Browser sockets don't have 'ping' event. Need to find a different way to detect connection loss. | ||
- Browser sockets don't have 'ping' event. Need to find a different way to detect connection loss. | ||
## Features | ||
- Supports compressed HTTP requests. |
@@ -6,2 +6,3 @@ import * as http from "http" | ||
import {log} from "../logger.js" | ||
import {decompressRequest} from "../utils/server" | ||
@@ -89,11 +90,13 @@ export async function serveHttpRequest( | ||
function readBody(req: http.IncomingMessage) { | ||
const decompressed = decompressRequest(req) | ||
return new Promise<string>((resolve, reject) => { | ||
let body = "" | ||
req.on("data", (chunk: Buffer) => { | ||
decompressed.on("data", (chunk: Buffer) => { | ||
body += chunk.toString() | ||
}) | ||
req.on("end", () => { | ||
decompressed.on("end", () => { | ||
resolve(body) | ||
}) | ||
req.on("error", (error: any) => { | ||
decompressed.on("error", (error: any) => { | ||
reject(error) | ||
@@ -100,0 +103,0 @@ }) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192975
101
4289
35