mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
Updated PreconditionFailed status occurences to more appropriate statuses. (#5513)
This commit is contained in:
@ -50,7 +50,7 @@ func ExtractOAuth2(config OAuth2Config, client *http.Client) func(http.Handler)
|
||||
|
||||
// Interfaces can hold a nil value
|
||||
if config == nil || reflect.ValueOf(config).IsNil() {
|
||||
httpapi.Write(ctx, rw, http.StatusPreconditionRequired, codersdk.Response{
|
||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||
Message: "The oauth2 method requested is not configured!",
|
||||
})
|
||||
return
|
||||
|
@ -40,7 +40,7 @@ func TestOAuth2(t *testing.T) {
|
||||
req := httptest.NewRequest("GET", "/", nil)
|
||||
res := httptest.NewRecorder()
|
||||
httpmw.ExtractOAuth2(nil, nil)(nil).ServeHTTP(res, req)
|
||||
require.Equal(t, http.StatusPreconditionRequired, res.Result().StatusCode)
|
||||
require.Equal(t, http.StatusBadRequest, res.Result().StatusCode)
|
||||
})
|
||||
t.Run("RedirectWithoutCode", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
Reference in New Issue
Block a user