internal/httputil: use error structs for http errors (#159)

The existing implementation used a ErrorResponse method to propogate
and create http error messages. Since we added functionality to
troubleshoot, signout, and do other tasks following an http error
it's useful to use Error struct in place of method arguments.

This fixes #157 where a troubleshooting links were appearing on pages
that it didn't make sense on (e.g. pages without valid sessions).
This commit is contained in:
Bobby DeSimone 2019-06-03 20:00:37 -07:00 committed by GitHub
parent 14403ce388
commit bade9f50e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 244 additions and 133 deletions

View file

@ -175,8 +175,8 @@ func TestValidateClientSecret(t *testing.T) {
}{
{"simple", "secret", "secret", "secret", http.StatusOK},
{"missing get param, valid header", "secret", "", "secret", http.StatusOK},
{"missing both", "secret", "", "", http.StatusUnauthorized},
{"simple bad", "bad-secret", "secret", "", http.StatusUnauthorized},
{"missing both", "secret", "", "", http.StatusInternalServerError},
{"simple bad", "bad-secret", "secret", "", http.StatusInternalServerError},
{"malformed, invalid hex digits", "secret", "%zzzzz", "", http.StatusBadRequest},
}