fix: don't force server errors in legacy server (#517)

* fix: don't force server errors in legacy server

* fix tests and be more consistent with the returned status code
This commit is contained in:
Tim Möhlmann 2024-01-17 17:06:45 +02:00 committed by GitHub
parent 844e2337bb
commit 57d04e7465
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 22 deletions

View file

@ -365,14 +365,14 @@ func Test_webServer_authorizeHandler(t *testing.T) {
},
},
{
name: "authorize error",
name: "server error",
fields: fields{
server: &requestVerifier{},
decoder: testDecoder,
},
r: httptest.NewRequest(http.MethodPost, "/authorize", strings.NewReader("foo=bar")),
want: webServerResult{
wantStatus: http.StatusBadRequest,
wantStatus: http.StatusInternalServerError,
wantBody: `{"error":"server_error"}`,
},
},
@ -1237,7 +1237,7 @@ func Test_webServer_simpleHandler(t *testing.T) {
},
r: httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(make([]byte, 11<<20))),
want: webServerResult{
wantStatus: http.StatusBadRequest,
wantStatus: http.StatusInternalServerError,
wantBody: `{"error":"server_error", "error_description":"io: read/write on closed pipe"}`,
},
},