h2lean 0.4.1 → 0.4.2

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.
@@ -564,7 +564,13 @@ class ClientHttp2Session extends EventEmitter {
564
564
  if (this.closed) {
565
565
  throw httpErr('ERR_HTTP2_GOAWAY_SESSION', 'New streams cannot be created after receiving a GOAWAY');
566
566
  }
567
- const options2 = options ? { ...options } : {};
567
+ // No defensive copy of options: node spreads it because it validates and
568
+ // then MUTATES the copy (setAndValidatePriorityOptions, options.endStream =
569
+ // ... in internal/http2/core.js request()); h2lean has no priority options
570
+ // and only reads endStream below, so the copy had no reader -- one object
571
+ // allocation per request removed. A null options now throws where it used
572
+ // to be silently accepted; node throws ERR_INVALID_ARG_TYPE there too
573
+ // (assertIsObject, measured live), so the throw is the closer shape.
568
574
  const list = [];
569
575
  let method = DEFAULT_METHOD;
570
576
  let sawMethod = false;
@@ -598,7 +604,7 @@ class ClientHttp2Session extends EventEmitter {
598
604
  list.push(':method', method);
599
605
  }
600
606
 
601
- let endStream = options2.endStream;
607
+ let endStream = options === undefined ? undefined : options.endStream;
602
608
  if (endStream === undefined) {
603
609
  endStream = payloadMeaningless(method);
604
610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h2lean",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Pure-JavaScript HTTP/2 for Node.js — a drop-in node:http2 replacement (server and client, h2c and TLS) with zero dependencies",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -46,9 +46,10 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@eslint/js": "^10.0.1",
49
+ "@passcod/faith": "^1.1.0",
49
50
  "eslint": "^10.14.0",
50
- "fastify": "^5.12.8",
51
51
  "fast-xml-parser": "^5.12.0",
52
+ "fastify": "^5.12.8",
52
53
  "uWebSockets.js": "github:uNetworking/UWebSockets.js#v20.70.0"
53
54
  }
54
55
  }