16212: Return 401 or 500 instead of 200 on authentication failure.
[arvados.git] / sdk / go / arvados / login.go
index 579c1083799888db480f0d3cd5cd1522a7f8a084..26c04b2c13603a2a7c9aa721b38a1fd5343c5228 100644 (file)
@@ -24,6 +24,9 @@ func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) {
                w.WriteHeader(http.StatusFound)
        } else if resp.Token != "" || resp.Message != "" {
                w.Header().Set("Content-Type", "application/json")
+               if resp.Token == "" {
+                       w.WriteHeader(http.StatusUnauthorized)
+               }
                json.NewEncoder(w).Encode(resp)
        } else {
                w.Header().Set("Content-Type", "text/html")