snap-on-openapi 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/services/ExpressWrapper/ExpressWrapper.js +6 -1
- package/dist/services/ExpressWrapper/types/ExpressResponse.d.ts +1 -1
- package/dist/services/TanstackStartWrapper/TanstackStartWrapper.js +2 -1
- package/dist/services/ValidationUtils/transformers/stringDateTransformer.js +1 -1
- package/package.json +1 -1
|
@@ -41,7 +41,12 @@ export class ExpressWrapper {
|
|
|
41
41
|
for (const header of Object.entries(result.headers)) {
|
|
42
42
|
res.header(header[0], header[1]);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
if (result.body instanceof Buffer) {
|
|
45
|
+
res.send(result.body);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
res.json(result.body);
|
|
49
|
+
}
|
|
45
50
|
};
|
|
46
51
|
const regex = new RegExp(`${route}.*`);
|
|
47
52
|
expressApp.get(regex, handler);
|
|
@@ -2,5 +2,5 @@ export interface ExpressResponse {
|
|
|
2
2
|
header: (name: string, value: string) => ExpressResponse;
|
|
3
3
|
status: (code: number) => ExpressResponse;
|
|
4
4
|
json: (data: unknown) => ExpressResponse;
|
|
5
|
-
send: (body: string) => ExpressResponse;
|
|
5
|
+
send: (body: string | Buffer) => ExpressResponse;
|
|
6
6
|
}
|
|
@@ -51,7 +51,8 @@ export class TanstackStartWrapper {
|
|
|
51
51
|
getOpenApiRootMethods() {
|
|
52
52
|
const processor = async (ctx) => {
|
|
53
53
|
const response = await this.service.processRootRoute(ctx.request);
|
|
54
|
-
const
|
|
54
|
+
const body = response.body instanceof Buffer ? response.body : JSON.stringify(response.body);
|
|
55
|
+
const res = new Response(body, {
|
|
55
56
|
status: response.status,
|
|
56
57
|
headers: response.headers,
|
|
57
58
|
});
|
package/package.json
CHANGED