From aac3ce46c7ba78740bc556fb732c131cc4e8887e Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Wed, 20 May 2015 13:35:23 -0700 Subject: [PATCH] Only do auth checks for endpoints starting with v2 Changes behavior so ping doesn't happen if /v2/ is anywhere in a request path, but instead only at the beginning. This fixes attempts to ping on redirected URLs. Signed-off-by: Derek McGowan (github: dmcgowan) --- docs/client/transport/session.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/client/transport/session.go b/docs/client/transport/session.go index 5086c021..90c8082c 100644 --- a/docs/client/transport/session.go +++ b/docs/client/transport/session.go @@ -94,7 +94,9 @@ HeaderLoop: func (ta *tokenAuthorizer) ModifyRequest(req *http.Request) error { v2Root := strings.Index(req.URL.Path, "/v2/") - if v2Root == -1 { + // Test if /v2/ does not exist or not at beginning + // TODO(dmcgowan) support v2 endpoints which have a prefix before /v2/ + if v2Root == -1 || v2Root > 0 { return nil }