guettli
(Thomas Güttler)
June 9, 2022, 6:37am
1
I am learning golang and playing around with http.ListenAndServe().
If one of my http Handler functions does a panic, the browser gets ERR_EMPTY_RESPONSE.
Is this the way real world http handling is implemented?
I thought that a http 500 “internal server error” gets returned on a panic.
Related example: Go by Example: HTTP Servers
NobbZ
(Norbert Melzer)
June 9, 2022, 7:00am
2
IIRC it depends on when your handler panics. If headers have already been written and the panic happens then, then the response can’t be changed to a 500
anymore.
1 Like
system
(system)
Closed
September 7, 2022, 7:01am
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.