From 0ab4b795bd16d6b781f331491365c975d14996c6 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Thu, 27 Jan 2022 15:28:00 -0700 Subject: [PATCH] return errnoauth on 401-403 for fe --- broker/fastexact.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/broker/fastexact.go b/broker/fastexact.go index 6b7e814..7eb0ae6 100644 --- a/broker/fastexact.go +++ b/broker/fastexact.go @@ -134,7 +134,19 @@ func (fe FastExact) newRequest(state config.State) (*http.Request, error) { } func (fe FastExact) doRequest(req *http.Request) (*http.Response, error) { - return do(req) + resp, err := do(req) + if err != nil { + return nil, err + } + if resp.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(resp.Body) + logtr.Errorf("fastExact bad status: %d: %s", resp.StatusCode, b) + if resp.StatusCode > 400 && resp.StatusCode < 404 { + return nil, ErrNoAuth + } + return nil, fmt.Errorf("bad status from FastExact: %d: %s", resp.StatusCode, b) + } + return resp, nil } func (fe FastExact) parse(resp *http.Response) ([]Job, error) {