mirror of
https://github.com/detleph/server.git
synced 2026-09-04 00:26:03 +02:00
[GH-ISSUE #24] The JSON parser throws an unhandled exception upon receiving ill-formatted input #10
Reference in New Issue
Block a user
Originally created by @stephan418 on GitHub (Dec 30, 2021).
Original GitHub issue: https://github.com/detleph/server/issues/24
Originally assigned to: @Stefan-5422 on GitHub.
The traceback is then forwarded to the client, which is, however, expecting a standard error response
@Stefan-5422 commented on GitHub (Jan 1, 2022):
Where is this standard responses detailed?
Also where is the documentation you were writing?
@stephan418 commented on GitHub (Jan 2, 2022):
The standard response is detailed nowhere, but it should use the format all other endpoints use (with type and payload fields; ref: https://github.com/detleph/server/blob/5b02905d7169a0a1b272fadf22aa178d084f4dbe/src/Controllers/admin.controller.ts#L181)
And I have documentation for the event endpoints. I stopped working on it, however, as it took me nearly 3 hours to write only this part (which is a fraction of the whole thing) and I don't think that is viable for such a limited-use API.
@stephan418 commented on GitHub (Jan 2, 2022):
And the error occurs whenever data which is not parsable by the JSON parser is sent to the server (for example the string "test"). When this is done, a 400 response with a plain-text traceback is returned
@Stefan-5422 commented on GitHub (Feb 27, 2022):
Note: This is reffring to the express json parser which will just return a stack trace instead of a normal response.