mirror of
https://github.com/hanzoai/trpc-openapi.git
synced 2026-10-30 18:18:55 +00:00
22 lines
691 B
JavaScript
22 lines
691 B
JavaScript
import { incomingMessageToRequest } from '@trpc/server/adapters/node-http';
|
|
export const acceptsRequestBody = (method) => {
|
|
if (method === 'GET' || method === 'DELETE') {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|
|
export const getContentType = (req) => {
|
|
if (req instanceof Request) {
|
|
return req.headers.get('content-type') ?? undefined;
|
|
}
|
|
return req.headers['content-type'] ?? undefined;
|
|
};
|
|
export const getRequestSignal = (req, res, maxBodySize) => {
|
|
if (req instanceof Request) {
|
|
return req.signal;
|
|
}
|
|
return incomingMessageToRequest(req, res, {
|
|
maxBodySize: maxBodySize ?? null,
|
|
}).signal;
|
|
};
|
|
//# sourceMappingURL=method.js.map
|