Skip to content

Commit

Permalink
fix(middleware): don't parse the payload string into JSON
Browse files Browse the repository at this point in the history
If we don't have `request.body`, don't parse the string payload into JSON, to avoid issues like #775
  • Loading branch information
wolfy1339 committed Jan 12, 2023
1 parent b68b94a commit b4861d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/middleware/node/get-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function getPayload(request: IncomingMessage): Promise<WebhookEvent | str
request.on("data", (chunk: string) => (data += chunk));
request.on("end", () => {
try {
resolve(JSON.parse(data));
resolve(data);
} catch (error: any) {
error.message = "Invalid JSON";
error.status = 400;
Expand Down

0 comments on commit b4861d1

Please sign in to comment.