docs: add X-Render-Time header to OpenAPI spec

This commit is contained in:
OpenClaw Subagent 2026-03-20 11:09:20 +01:00
parent 4a2103c60e
commit eea9489efc
5 changed files with 58 additions and 0 deletions

View file

@ -96,6 +96,32 @@ describe("OpenAPI spec accuracy", () => {
});
});
const allConversionEndpoints = [
"/v1/convert/html",
"/v1/convert/markdown",
"/v1/convert/url",
"/v1/demo/html",
"/v1/demo/markdown",
];
describe("X-Render-Time header", () => {
it("should define X-Render-Time header component", () => {
expect(spec.components.headers["X-Render-Time"]).toBeDefined();
expect(spec.components.headers["X-Render-Time"].schema.type).toBe("integer");
expect(spec.components.headers["X-Render-Time"].description).toContain("render time");
});
allConversionEndpoints.forEach((endpoint) => {
it(`${endpoint} 200 response should include X-Render-Time header`, () => {
const response200 = spec.paths[endpoint]?.post?.responses["200"];
expect(response200.headers["X-Render-Time"]).toBeDefined();
expect(response200.headers["X-Render-Time"].$ref).toBe(
"#/components/headers/X-Render-Time"
);
});
});
});
it("should mention rate limit headers in API description", () => {
const description = spec.info.description;
expect(description).toContain("X-RateLimit-Limit");