tsweb: allow HTTPError to unwrap errors

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris
2022-10-04 20:39:10 -07:00
committed by Will Norris
parent 2243dbccb7
commit 62bc1052a2
2 changed files with 10 additions and 0 deletions

View File

@ -327,6 +327,14 @@ func BenchmarkLog(b *testing.B) {
}
}
func TestHTTPError_Unwrap(t *testing.T) {
wrappedErr := fmt.Errorf("wrapped")
err := Error(404, "not found", wrappedErr)
if got := errors.Unwrap(err); got != wrappedErr {
t.Errorf("HTTPError.Unwrap() = %v, want %v", got, wrappedErr)
}
}
func TestVarzHandler(t *testing.T) {
t.Run("globals_log", func(t *testing.T) {
rec := httptest.NewRecorder()