fix: refine Swagger docs headers and dynamic examples
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { config } from '../env';
|
||||||
|
|
||||||
const errorSchema = (example: string) => ({
|
const errorSchema = (example: string) => ({
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
@@ -117,7 +119,7 @@ export const handleSwaggerJson = async (): Promise<Response> => {
|
|||||||
},
|
},
|
||||||
download_url: {
|
download_url: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
example: 'https://tele.asepharyana.tech/f/xYz123',
|
example: `${config.baseUrl}/f/xYz123`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -269,6 +271,8 @@ export const handleSwaggerHtml = async (): Promise<Response> => {
|
|||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'text/html; charset=utf-8',
|
'content-type': 'text/html; charset=utf-8',
|
||||||
|
'access-control-allow-origin': '*',
|
||||||
|
'x-content-type-options': 'nosniff',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user