@@ -46,2 +46,5 @@ import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest, TrustProxyOption } from "../_chunks/types.mjs"; | ||
| }; | ||
| json(data: unknown, init?: ResponseInit): globalThis.Response & { | ||
| _toNodeResponse: () => PreparedNodeResponse; | ||
| }; | ||
| }; | ||
@@ -48,0 +51,0 @@ type NodeResponse = InstanceType<typeof NodeResponse>; |
@@ -512,2 +512,17 @@ import { FastURL, lazyInherit } from "../_chunks/_url.mjs"; | ||
| } | ||
| static json(data, init) { | ||
| const body = JSON.stringify(data); | ||
| if (body === void 0) throw new TypeError("Value is not JSON serializable"); | ||
| let headers = init?.headers; | ||
| if (!headers) headers = { "content-type": "application/json" }; | ||
| else { | ||
| const merged = new Headers(headers); | ||
| if (!merged.has("content-type")) merged.set("content-type", "application/json"); | ||
| headers = merged; | ||
| } | ||
| return new NodeResponse(body, init ? { | ||
| ...init, | ||
| headers | ||
| } : { headers }); | ||
| } | ||
| get status() { | ||
@@ -514,0 +529,0 @@ return this.#response?.status || this.#init?.status || 200; |
+1
-1
@@ -208,3 +208,3 @@ import { bold, cyan, gray, green, magenta, red, url, yellow } from "./_chunks/_utils.mjs"; | ||
| name: "srvx", | ||
| version: "0.11.22", | ||
| version: "0.12.0", | ||
| description: "Universal Server." | ||
@@ -211,0 +211,0 @@ }; |
+1
-1
| { | ||
| "name": "srvx", | ||
| "version": "0.12.0", | ||
| "version": "0.12.1", | ||
| "description": "Universal Server.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://srvx.h3.dev", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
161843
0.38%3489
0.43%