Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors being returned as text, return as json #1

Open
DavideCarvalho opened this issue Feb 5, 2023 · 1 comment
Open

Errors being returned as text, return as json #1

DavideCarvalho opened this issue Feb 5, 2023 · 1 comment

Comments

@DavideCarvalho
Copy link

On this part of the code

if (schemaValidationErrors) {
  res.status(400).end(schemaValidationErrors);
  return;
}

It return the errors as "application/text"

image

I think changing to this:

if (schemaValidationErrors) {
  return res.status(400).json(schemaValidationErrors);
}

should fix that

@DavideCarvalho
Copy link
Author

I was able to make it work using "pnpm patch" command. If you use npm, you can try "patch-package"

I changed from "JSON.stringify({ errors })" to only "({ errors })"

And the res.status.json part also

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant