diff options
author | Małgorzata Ksionek <mksionek@gitlab.com> | 2019-09-23 09:48:01 +0200 |
---|---|---|
committer | Małgorzata Ksionek <mksionek@gitlab.com> | 2019-09-26 12:26:53 +0200 |
commit | 8071ea113454ae26ad9822c0a41efc5bc45f3de2 (patch) | |
tree | 6f8849952a892de5f9c4583e0ddc0059e26f59e2 /go/internal/gitlabnet | |
parent | 216bfafb4c0001a476e5ca630cd8c3baf7718d8d (diff) | |
download | gitlab-shell-8071ea113454ae26ad9822c0a41efc5bc45f3de2.tar.gz |
Add cr remarks
Diffstat (limited to 'go/internal/gitlabnet')
-rw-r--r-- | go/internal/gitlabnet/client.go | 2 | ||||
-rw-r--r-- | go/internal/gitlabnet/client_test.go | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/go/internal/gitlabnet/client.go b/go/internal/gitlabnet/client.go index b668fbd..3aa30ad 100644 --- a/go/internal/gitlabnet/client.go +++ b/go/internal/gitlabnet/client.go @@ -109,7 +109,7 @@ func (c *GitlabClient) DoRequest(method, path string, data interface{}) (*http.R request.Header.Set(secretHeaderName, encodedSecret) request.Header.Add("Content-Type", "application/json") - request.Header.Add("X_FORWARDED_FOR", c.config.IpAddr()) + request.Header.Add("X_FORWARDED_FOR", c.config.IPAddr) request.Close = true diff --git a/go/internal/gitlabnet/client_test.go b/go/internal/gitlabnet/client_test.go index 07ac7b8..3f25d3c 100644 --- a/go/internal/gitlabnet/client_test.go +++ b/go/internal/gitlabnet/client_test.go @@ -6,7 +6,6 @@ import ( "fmt" "io/ioutil" "net/http" - "os" "path" "testing" @@ -108,7 +107,7 @@ func TestClients(t *testing.T) { tc.config.GitlabUrl = url tc.config.Secret = "sssh, it's a secret" - + tc.config.IPAddr = "127.0.0.1" client, err := GetClient(tc.config) require.NoError(t, err) @@ -229,9 +228,6 @@ func testAuthenticationHeader(t *testing.T, client *GitlabClient) { func testXForwardedForHeader(t *testing.T, client *GitlabClient) { t.Run("X-Forwarded-For for GET", func(t *testing.T) { - err := os.Setenv("SSH_CONNECTION", "127.0.0.1 0") - require.Nil(t, err) - response, err := client.Get("/with_ip") require.NoError(t, err) @@ -241,7 +237,6 @@ func testXForwardedForHeader(t *testing.T, client *GitlabClient) { t.Run("X-Forwarded-For for POST", func(t *testing.T) { data := map[string]string{"key": "value"} - os.Setenv("SSH_CONNECTION", "127.0.0.1 0") response, err := client.Post("/with_ip", data) require.NoError(t, err) |