Buckets:
| --- | |
| title: Invalid API Route Status/Body Response | |
| --- | |
| ## Why This Error Occurred | |
| In one of your API routes a 204 or 304 status code was used as well as sending a response body. | |
| This is invalid as a 204 or 304 status code dictates no response body should be present. | |
| ## Possible Ways to Fix It | |
| Send an empty body when using a 204 or 304 status code or use a different status code while sending a response body. | |
| Before | |
| ```js filename="pages/api/example.js" | |
| export default function handler(req, res) { | |
| res.status(204).send('invalid body') | |
| } | |
| ``` | |
| After | |
| ```js filename="pages/api/example.js" | |
| export default function handler(req, res) { | |
| res.status(204).end() | |
| } | |
| ``` | |
| ## Useful Links | |
| - [204 status code documentation](https://developer.mozilla.org/docs/Web/HTTP/Status/204) | |
| - [304 status code documentation](https://developer.mozilla.org/docs/Web/HTTP/Status/304) | |
Xet Storage Details
- Size:
- 869 Bytes
- Xet hash:
- b08998169464d5b1dafb38f5589c360a6d1d80f504552a29d3774eb1d5a4f1eb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.