Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmcdo29/nest-gql-validation-status
A simple repo to show that the HTTP status is still a 200 with the ValidationPipe throwing an error in GraphQL
https://github.com/jmcdo29/nest-gql-validation-status
Last synced: 23 days ago
JSON representation
A simple repo to show that the HTTP status is still a 200 with the ValidationPipe throwing an error in GraphQL
- Host: GitHub
- URL: https://github.com/jmcdo29/nest-gql-validation-status
- Owner: jmcdo29
- Created: 2022-03-31T16:29:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T22:40:34.000Z (about 1 year ago)
- Last Synced: 2024-10-03T20:23:14.288Z (about 1 month ago)
- Language: TypeScript
- Size: 686 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GQL-Not-400
Just a simple repo to show that letting the `ValidationPipe` from Nest throw a `BadRequestException` does not result in an HTTP 400, though there is a status code reported inside the response. The HTTP status is still 200 as is standard with GraphQL.
## Reproduction Steps
```
1. git clone
2. pnpm i / npm i / yarn
3. pnpm start:dev / npm run start:dev / yarn start:dev
4. In a separate terminal run:
curl 'http://localhost:3000/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: http://localhost:3000' --data-binary '{"query":"mutation sayYo {sayWhatYouWant(input:{key:\"yo\"}){key}}"}' --compressed -v
5. Notice the HTTP status as 200
```