Skip to content

Commit

Permalink
fixing #21 - bad only handling JSON bodies now
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell committed Jan 30, 2023
1 parent 11e20df commit 80d523f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ function parseBody(
contentType: string | undefined,
): object | string {
if (body) {
if (contentType === 'application/json' && typeof body === 'string') {
return JSON.parse(body);
}
if (contentType === 'text/plain') {
if (contentType === 'application/json') {
if (typeof body === 'string') {
return JSON.parse(body);
}
return body;
}
}
Expand Down

0 comments on commit 80d523f

Please sign in to comment.