BREAKING: There is no public Rust API for the CLI (#5226)

This commit is contained in:
Ryan Dahl 2020-05-11 17:33:36 -04:00 committed by GitHub
parent 3cccadcf0f
commit 73d8fa74c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 786 additions and 711 deletions

View file

@ -37,7 +37,7 @@ const serverArgs = parse(args) as FileServerArgs;
const CORSEnabled = serverArgs.cors ? true : false;
const target = posix.resolve(serverArgs._[1] ?? "");
const addr = `0.0.0.0:${serverArgs.port ?? serverArgs.p ?? 4500}`;
const addr = `0.0.0.0:${serverArgs.port ?? serverArgs.p ?? 4507}`;
const MEDIA_TYPES: Record<string, string> = {
".md": "text/markdown",

View file

@ -36,7 +36,7 @@ function killFileServer(): void {
test("file_server serveFile", async (): Promise<void> => {
await startFileServer();
try {
const res = await fetch("http://localhost:4500/README.md");
const res = await fetch("http://localhost:4507/README.md");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
assertEquals(res.headers.get("content-type"), "text/markdown");
@ -53,7 +53,7 @@ test("file_server serveFile", async (): Promise<void> => {
test("serveDirectory", async function (): Promise<void> {
await startFileServer();
try {
const res = await fetch("http://localhost:4500/");
const res = await fetch("http://localhost:4507/");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
const page = await res.text();
@ -75,7 +75,7 @@ test("serveDirectory", async function (): Promise<void> {
test("serveFallback", async function (): Promise<void> {
await startFileServer();
try {
const res = await fetch("http://localhost:4500/badfile.txt");
const res = await fetch("http://localhost:4507/badfile.txt");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
assertEquals(res.status, 404);
@ -88,12 +88,12 @@ test("serveFallback", async function (): Promise<void> {
test("serveWithUnorthodoxFilename", async function (): Promise<void> {
await startFileServer();
try {
let res = await fetch("http://localhost:4500/http/testdata/%");
let res = await fetch("http://localhost:4507/http/testdata/%");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
assertEquals(res.status, 200);
let _ = await res.text();
res = await fetch("http://localhost:4500/http/testdata/test%20file.txt");
res = await fetch("http://localhost:4507/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);