return body if body type is undefined

This commit is contained in:
Jorrin
2024-01-25 19:27:19 +01:00
parent 65ff4ab91a
commit f49cd01b7a

View File

@@ -16,7 +16,7 @@ export interface Request extends BaseRequest {
readHeaders?: Record<string, string>;
url: string;
body?: any;
bodyType: 'string' | 'FormData' | 'URLSearchParams' | 'object';
bodyType?: 'string' | 'FormData' | 'URLSearchParams' | 'object';
}
type Response<T> = BaseResponse<{
@@ -49,7 +49,7 @@ const mapBodyToFetchBody = (body: Request['body'], bodyType: Request['bodyType']
if (bodyType === 'string') {
return body;
}
return undefined;
return body;
};
const handler: PlasmoMessaging.MessageHandler<Request, Response<any>> = async (req, res) => {