aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/http/node-http.test.ts
diff options
context:
space:
mode:
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();
+ });
});