Skip to content

Commit

Permalink
console: lib/api fix bug: API endpoint without explicit body type doe…
Browse files Browse the repository at this point in the history
…s not accept json content type
  • Loading branch information
absorbb committed Aug 26, 2024
1 parent 33412f5 commit a86b014
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webapps/console/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function nextJsApiHandler(api: Api): NextApiHandler {
body = parseResult.data;
} else if (req.body) {
try {
body = JSON.parse(req.body);
body = parseIfNeeded(req.body);
} catch (e) {
throw new ApiError(`Body ${req.method} ${req.url} is not a JSON object: ${getErrorMessage(e)}`, {
body: req.body,
Expand Down

0 comments on commit a86b014

Please sign in to comment.