diff --git a/src/widgets/dockhand/proxy.test.js b/src/widgets/dockhand/proxy.test.js index 989e14e22..fdd4b845c 100644 --- a/src/widgets/dockhand/proxy.test.js +++ b/src/widgets/dockhand/proxy.test.js @@ -79,4 +79,27 @@ describe("widgets/dockhand/proxy", () => { expect(res.body.error.message).toBe("HTTP Error"); expect(res.body.error.url).toContain("token=***"); }); + + it("supports token auth", async () => { + getServiceWidget.mockResolvedValue({ + type: "dockhand", + url: "http://dockhand", + key: "abc", + }); + + httpProxy.mockResolvedValueOnce([200, "application/json", Buffer.from("ok")]); + + const req = { + method: "GET", + query: { group: "g", service: "svc", endpoint: "api/v1/status", index: "0" }, + }; + const res = createMockRes(); + + await dockhandProxyHandler(req, res); + + expect(httpProxy).toHaveBeenCalledWith( + new URL("http://dockhand/api/v1/status"), + expect.objectContaining({ method: "GET", headers: { Authorization: "Bearer abc" } }), + ); + }); });