mirror of
https://github.com/outline/outline.git
synced 2026-11-30 17:10:36 +03:00
* fix: Add WWW-Authenticate header to API 401 responses * fix: Keep a challenge set on the response
33 lines
904 B
TypeScript
33 lines
904 B
TypeScript
import { getTestServer } from "@server/test/support";
|
|
|
|
const server = getTestServer();
|
|
|
|
describe("POST unknown endpoint", () => {
|
|
it("should be not found", async () => {
|
|
const res = await server.post("/api/blah");
|
|
expect(res.status).toEqual(404);
|
|
});
|
|
});
|
|
|
|
describe("GET unknown endpoint", () => {
|
|
it("should be not found", async () => {
|
|
const res = await server.get("/api/blah");
|
|
expect(res.status).toEqual(404);
|
|
});
|
|
});
|
|
|
|
describe("PATCH unknown endpoint", () => {
|
|
it("should be method not allowed", async () => {
|
|
const res = await server.patch("/api/blah");
|
|
expect(res.status).toEqual(405);
|
|
});
|
|
});
|
|
|
|
describe("unauthenticated request", () => {
|
|
it("should include a Bearer challenge", async () => {
|
|
const res = await server.post("/api/auth.info");
|
|
expect(res.status).toEqual(401);
|
|
expect(res.headers.get("www-authenticate")).toEqual("Bearer");
|
|
});
|
|
});
|