You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/tsweb
chungdaniel e7ac9a4b90
tsweb: refactor JSONHandler to take status code from error if it is present (#905)
This change is to make JSONHandler error handling intuitive, as before there would be two sources of HTTP status code when HTTPErrors were generated: one as the first return value of the handler function, and one nested inside the HTTPError. Previously, it took the first return value as the status code, and ignored the code inside the HTTPError. Now, it should expect the first return value to be 0 if there is an error, and it takes the status code of the HTTPError to set as the response code.

Signed-off-by: Daniel Chung <daniel@tailscale.com>
4 years ago
..
jsonhandler.go tsweb: refactor JSONHandler to take status code from error if it is present (#905) 4 years ago
jsonhandler_test.go tsweb: refactor JSONHandler to take status code from error if it is present (#905) 4 years ago
log.go tsweb: use a ResponseWriter wrapper to log more accurately. 5 years ago
tsweb.go tsweb: add StatusCodeCounters to HandlerOptions 4 years ago
tsweb_test.go tsweb: add StdHandlerOpts that accepts an options struct 4 years ago