spooder 6.1.95 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bun.lock +1 -1
  2. package/package.json +1 -1
  3. package/src/api.ts +5 -1
package/bun.lock CHANGED
@@ -12,7 +12,7 @@
12
12
  "packages": {
13
13
  "@types/bun": ["@types/bun@1.3.5", "", { "dependencies": { "bun-types": "1.3.5" } }, "sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w=="],
14
14
 
15
- "@types/node": ["@types/node@25.0.6", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-NNu0sjyNxpoiW3YuVFfNz7mxSQ+S4X2G28uqg2s+CzoqoQjLPsWSbsFFyztIAqt2vb8kfEAsJNepMGPTxFDx3Q=="],
15
+ "@types/node": ["@types/node@25.0.7", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-C/er7DlIZgRJO7WtTdYovjIFzGsz0I95UlMyR9anTb4aCpBSRWe5Jc1/RvLKUfzmOxHPGjSE5+63HgLtndxU4w=="],
16
16
 
17
17
  "bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="],
18
18
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "spooder",
3
3
  "author": "Kruithne <kruithne@gmail.com>",
4
4
  "type": "module",
5
- "version": "6.1.95",
5
+ "version": "6.2.0",
6
6
  "module": "./src/api.ts",
7
7
  "repository": {
8
8
  "url": "https://github.com/Kruithne/spooder"
package/src/api.ts CHANGED
@@ -1384,7 +1384,7 @@ type ErrorHandler = (err: Error, req: Request, url: URL) => Resolvable<Response>
1384
1384
  type DefaultHandler = (req: Request, status_code: number) => HandlerReturnType;
1385
1385
  type StatusCodeHandler = (req: Request) => HandlerReturnType;
1386
1386
 
1387
- type JSONRequestHandler = (req: Request, url: URL, json: JsonObject) => HandlerReturnType;
1387
+ type JSONRequestHandler = (req: Request, url: URL, json: JsonObject | null) => HandlerReturnType;
1388
1388
 
1389
1389
  export type ServerSentEventClient = {
1390
1390
  message: (message: string) => void;
@@ -1868,6 +1868,10 @@ export function http_serve(port: number, hostname?: string) {
1868
1868
  }
1869
1869
 
1870
1870
  try {
1871
+ // GET/HEAD requests don't have bodies, skip validation
1872
+ if (req.method === 'GET' || req.method === 'HEAD')
1873
+ return handler(req, url, null);
1874
+
1871
1875
  if (req.headers.get('Content-Type') !== 'application/json')
1872
1876
  return 400; // Bad Request
1873
1877