diff options
| author | Xe <xe@tailscale.com> | 2022-07-22 12:38:24 -0400 |
|---|---|---|
| committer | Xe <xe@tailscale.com> | 2022-07-22 12:38:24 -0400 |
| commit | 1444e34521e565d2077e684863e68cb9befdef3b (patch) | |
| tree | f9e38c62518ef834e64957b24f803c0ec02fbcf2 | |
| parent | 707df2efb297451ac49d6b9a7f7554c26678d4de (diff) | |
| download | tailscale-Xe/gitops-pusher-ffcli.tar.xz tailscale-Xe/gitops-pusher-ffcli.zip | |
cmd/gitops-pusher: fix minor bug with ACL testsXe/gitops-pusher-ffcliXe/gitops-pusher-acl-test-error-output
Signed-off-by: Xe <xe@tailscale.com>
| -rw-r--r-- | cmd/gitops-pusher/gitops-pusher.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd/gitops-pusher/gitops-pusher.go b/cmd/gitops-pusher/gitops-pusher.go index fc1861bdb..1f182cf4c 100644 --- a/cmd/gitops-pusher/gitops-pusher.go +++ b/cmd/gitops-pusher/gitops-pusher.go @@ -15,6 +15,7 @@ import ( "fmt" "log" "net/http" + "net/http/httputil" "os" "regexp" "strings" @@ -237,12 +238,6 @@ func testNewACLs(ctx context.Context, tailnet, apiKey, policyFname string) error } defer resp.Body.Close() - got := resp.StatusCode - want := http.StatusOK - if got != want { - return fmt.Errorf("wanted HTTP status code %d but got %d", want, got) - } - var ate ACLTestError err = json.NewDecoder(resp.Body).Decode(&ate) if err != nil { @@ -253,6 +248,14 @@ func testNewACLs(ctx context.Context, tailnet, apiKey, policyFname string) error return ate } + got := resp.StatusCode + want := http.StatusOK + if got != want { + data, _ := httputil.DumpResponse(resp, true) + os.Stderr.Write(data) + return fmt.Errorf("wanted HTTP status code %d but got %d", want, got) + } + return nil } |
