X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0e077171d332434bf727a018691165a6b0621b68..ffa1fd1fdf584c71e248e9bb7d523f788a517510:/sdk/go/arvados/login.go diff --git a/sdk/go/arvados/login.go b/sdk/go/arvados/login.go index 8c515468cc..ab76375462 100644 --- a/sdk/go/arvados/login.go +++ b/sdk/go/arvados/login.go @@ -10,15 +10,26 @@ import ( ) type LoginResponse struct { - RedirectLocation string - HTML bytes.Buffer + RedirectLocation string `json:"redirect_location,omitempty"` + HTML bytes.Buffer `json:"-"` } func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) { + w.Header().Set("Cache-Control", "no-store") if resp.RedirectLocation != "" { w.Header().Set("Location", resp.RedirectLocation) w.WriteHeader(http.StatusFound) } else { + w.Header().Set("Content-Type", "text/html") w.Write(resp.HTML.Bytes()) } } + +type LogoutResponse struct { + RedirectLocation string `json:"redirect_location,omitempty"` +} + +func (resp LogoutResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) { + w.Header().Set("Location", resp.RedirectLocation) + w.WriteHeader(http.StatusFound) +}