it(notFoundTests, "without extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid");
const body = await response.json();
assertEquals(response.status, 404);
assertEquals(
response.headers.get("Content-Type"),
"application/json; charset=UTF-8",
);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, {
error: { name: "NotFoundError", message: "Not found", status: 404 },
});
});
it(notFoundTests, "with json extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid.json");
const body = await response.text();
assertEquals(response.status, 404);
assertEquals(response.headers.get("Content-Type"), null);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, "");
});
it(notFoundTests, "without extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid");
const body = await response.json();
assertEquals(response.status, 404);
assertEquals(
response.headers.get("Content-Type"),
"application/json; charset=UTF-8",
);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, {
error: { name: "NotFoundError", message: "Not found", status: 404 },
});
});
it(notFoundTests, "with json extension", async () => {
const response = await fetch("http://localhost:9001/api/invalid.json");
const body = await response.text();
assertEquals(response.status, 404);
assertEquals(response.headers.get("Content-Type"), null);
assert(response.headers.has("X-Response-Time"));
assert(!response.headers.has("etag"));
assertEquals(body, "");
});