summaryrefslogtreecommitdiff
path: root/std/http/file_server_test.ts
diff options
context:
space:
mode:
author木杉 <zhmushan@qq.com>2020-02-12 04:53:09 +0800
committerGitHub <noreply@github.com>2020-02-11 15:53:09 -0500
commit92019498f6361c31ad24decfc14e81660959f6cb (patch)
tree0ce0fb9a5f00916ae7767b5062f7702cfc9a5229 /std/http/file_server_test.ts
parentb67f20be3b5234bad2565c1770fa89d49942b342 (diff)
fix(file_server): don't crash on "%" pathname (#3953)
Diffstat (limited to 'std/http/file_server_test.ts')
-rw-r--r--std/http/file_server_test.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/std/http/file_server_test.ts b/std/http/file_server_test.ts
index ba625b7c8..0329168e7 100644
--- a/std/http/file_server_test.ts
+++ b/std/http/file_server_test.ts
@@ -83,12 +83,15 @@ test(async function serveFallback(): Promise<void> {
}
});
-test(async function serveFallback(): Promise<void> {
+test(async function serveWithUnorthodoxFilename(): Promise<void> {
await startFileServer();
try {
- const res = await fetch(
- "http://localhost:4500/http/testdata/test%20file.txt"
- );
+ let res = await fetch("http://localhost:4500/http/testdata/%");
+ assert(res.headers.has("access-control-allow-origin"));
+ assert(res.headers.has("access-control-allow-headers"));
+ assertEquals(res.status, 200);
+
+ res = await fetch("http://localhost:4500/http/testdata/test%20file.txt");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
assertEquals(res.status, 200);