aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/http/node-http.test.ts
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-06-29 23:36:18 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-29 20:36:18 -0700
commitb9460087e391c454f323390a42902a3ed024c8bc (patch)
treed271cce864ac8f3a728f8335d5f9952df0a4a1fb /test/js/node/http/node-http.test.ts
parentc42a00f9df7423e60a23a1194731ca7c85a7d16f (diff)
downloadbun-b9460087e391c454f323390a42902a3ed024c8bc.tar.gz
bun-b9460087e391c454f323390a42902a3ed024c8bc.tar.zst
bun-b9460087e391c454f323390a42902a3ed024c8bc.zip
Fixes `node:http` and `node:stream` so `ytdl-core` works. (#3452)
* fix crash in readablestate * make node:https request+get actually use https * use a native readablestream in IncomingMessage * tweaks * fix abort crash * emit close by default * remove abort. this isnt a real function * add validate functions, fixup some other requested changes. not done yet * Update WebCoreJSBuiltins.cpp * Update JSReadableState.cpp * Add some missing exports --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r--test/js/node/http/node-http.test.ts23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts
index b1910a1f7..3e7da9d34 100644
--- a/test/js/node/http/node-http.test.ts
+++ b/test/js/node/http/node-http.test.ts
@@ -1,5 +1,14 @@
// @ts-nocheck
-import { createServer, request, get, Agent, globalAgent, Server } from "node:http";
+import {
+ createServer,
+ request,
+ get,
+ Agent,
+ globalAgent,
+ Server,
+ validateHeaderName,
+ validateHeaderValue,
+} from "node:http";
import { createTest } from "node-harness";
const { describe, expect, it, beforeAll, afterAll, createDoneDotAll } = createTest(import.meta.path);
@@ -624,4 +633,16 @@ describe("node:http", () => {
});
});
});
+
+ test("validateHeaderName", () => {
+ validateHeaderName("Foo");
+ expect(() => validateHeaderName("foo:")).toThrow();
+ expect(() => validateHeaderName("foo:bar")).toThrow();
+ });
+
+ test("validateHeaderValue", () => {
+ validateHeaderValue("Foo", "Bar");
+ expect(() => validateHeaderValue("Foo", undefined as any)).toThrow();
+ expect(() => validateHeaderValue("Foo", "Bar\r")).toThrow();
+ });
});