mirror of
https://github.com/LukeHagar/arbiter.git
synced 2025-12-06 04:19:14 +00:00
Saving all progress
This commit is contained in:
15
dist/middleware/apiDocGenerator.js
vendored
Normal file
15
dist/middleware/apiDocGenerator.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { openApiStore } from '../store/openApiStore.js';
|
||||
export const apiDocGenerator = async (c, next) => {
|
||||
await next();
|
||||
// Record the API call in OpenAPI format
|
||||
openApiStore.recordEndpoint(c.req.path, c.req.method.toLowerCase(), {
|
||||
query: Object.fromEntries(new URL(c.req.url).searchParams),
|
||||
body: await c.req.json().catch(() => null),
|
||||
contentType: c.req.header('content-type') || 'application/json',
|
||||
}, {
|
||||
status: c.res.status,
|
||||
body: await c.res.clone().json().catch(() => null),
|
||||
contentType: c.res.headers.get('content-type') || 'application/json',
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=apiDocGenerator.js.map
|
||||
Reference in New Issue
Block a user