@push-rpc/next
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -13,3 +13,3 @@ "use strict"; | ||
const itemName = req.url.slice(path.length + 1); | ||
const isJson = req.headersDistinct["content-type"]?.includes("application/json") ?? false; | ||
const isJson = req.headers["content-type"]?.includes("application/json") ?? false; | ||
const textBody = await readBody(req); | ||
@@ -16,0 +16,0 @@ let body = isJson && !!textBody ? (0, json_js_1.safeParseJson)(textBody) : []; |
@@ -27,4 +27,5 @@ "use strict"; | ||
async createConnectionContext(req) { | ||
const header = req.headers[rpc_js_1.CLIENT_ID_HEADER]; | ||
return { | ||
clientId: req.headersDistinct[rpc_js_1.CLIENT_ID_HEADER]?.[0] || "anon", | ||
clientId: (Array.isArray(header) ? header[0] : header) || "anon", | ||
}; | ||
@@ -31,0 +32,0 @@ }, |
{ | ||
"name": "@push-rpc/next", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -30,2 +30,3 @@ ## 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. |
@@ -23,3 +23,3 @@ import * as http from "http" | ||
const isJson = req.headersDistinct["content-type"]?.includes("application/json") ?? false | ||
const isJson = req.headers["content-type"]?.includes("application/json") ?? false | ||
const textBody = await readBody(req) | ||
@@ -26,0 +26,0 @@ let body = isJson && !!textBody ? safeParseJson(textBody) : [] |
@@ -62,6 +62,8 @@ import {CLIENT_ID_HEADER, RpcConnectionContext, RpcContext, Services} from "../rpc.js" | ||
async createConnectionContext(req: IncomingMessage): Promise<RpcConnectionContext> { | ||
const header = req.headers[CLIENT_ID_HEADER] | ||
return { | ||
clientId: req.headersDistinct[CLIENT_ID_HEADER]?.[0] || "anon", | ||
clientId: (Array.isArray(header) ? header[0] : header) || "anon", | ||
} | ||
}, | ||
} |
Sorry, the diff of this file is not supported yet
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
188615
4211
31