From 959bf9c97bbea7cefef58f5076a34714926832d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 00:28:46 +0000 Subject: [PATCH 1/2] Bump github.com/mccutchen/go-httpbin/v2 from 2.5.4 to 2.9.2 Bumps [github.com/mccutchen/go-httpbin/v2](https://github.com/mccutchen/go-httpbin) from 2.5.4 to 2.9.2. - [Release notes](https://github.com/mccutchen/go-httpbin/releases) - [Commits](https://github.com/mccutchen/go-httpbin/compare/v2.5.4...v2.9.2) --- updated-dependencies: - dependency-name: github.com/mccutchen/go-httpbin/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 14ae7d8..2f4a8de 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/getlantern/systray v1.2.2 github.com/google/uuid v1.3.0 github.com/martinlindhe/inputbox v0.0.0-20210326232244-b26136a79ad0 - github.com/mccutchen/go-httpbin/v2 v2.5.4 + github.com/mccutchen/go-httpbin/v2 v2.9.2 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/stretchr/testify v1.8.4 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 diff --git a/go.sum b/go.sum index b823b11..15d8e3a 100644 --- a/go.sum +++ b/go.sum @@ -90,8 +90,8 @@ github.com/masterzen/winrm v0.0.0-20161014151040-7a535cd943fc/go.mod h1:CfZSN7zw github.com/masterzen/xmlpath v0.0.0-20140218185901-13f4951698ad/go.mod h1:A0zPC53iKKKcXYxr4ROjpQRQ5FgJXtelNdSmHHuq/tY= github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mccutchen/go-httpbin/v2 v2.5.4 h1:V9S1WEHUk0LMo0Y/vFgHV2cZSS2mCs95Wx2JJu2DI8g= -github.com/mccutchen/go-httpbin/v2 v2.5.4/go.mod h1:+DBHcmg6EOeoizuiOI8iL12VIHXx+9YQNlz+gjB9uxk= +github.com/mccutchen/go-httpbin/v2 v2.9.2 h1:bte68xUmv/MXyIlDv+hBUinoxcPHxZ1BKxyQlsToJD0= +github.com/mccutchen/go-httpbin/v2 v2.9.2/go.mod h1:+DBHcmg6EOeoizuiOI8iL12VIHXx+9YQNlz+gjB9uxk= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= From bdba9960f39598649b9ba304d8efe24527610de9 Mon Sep 17 00:00:00 2001 From: SamJakob Date: Tue, 4 Jul 2023 02:21:56 +0100 Subject: [PATCH 2/2] Fix TestPostDataJson (go-httpbin PR #117 broke it when they started returning binary payloads from httpbin as base64, but we specified the content type as 'json', not 'application/json' so it was treated as unrecognized and base64-encoded) --- go.mod | 3 +++ go.sum | 5 +++++ libproxy/proxy.go | 2 +- libproxy/proxy_test.go | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 2f4a8de..df98451 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( require ( github.com/bhendo/go-powershell v0.0.0-20190719160123-219e7fb4e41e // indirect + github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/getlantern/context v0.0.0-20220418194847-3d5e7a086201 // indirect github.com/getlantern/errors v1.0.1 // indirect @@ -37,6 +38,8 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect + golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect golang.org/x/sys v0.1.0 // indirect + golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 15d8e3a..8376b7f 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/bhendo/go-powershell v0.0.0-20190719160123-219e7fb4e41e h1:KCjb01YiNoRaJ5c+SbnPLWjVzU9vqRYHg3e5JcN50nM= github.com/bhendo/go-powershell v0.0.0-20190719160123-219e7fb4e41e/go.mod h1:f7vw6ObmmNcyFQLhZX9eUGBJGpnwTJFDvVjqZxIxHWY= +github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa h1:Wg+722vs7a2zQH5lR9QWYsVbplKeffaQFIs5FTdfNNo= +github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa/go.mod h1:6Arca19mRx58CA7OWEd7Wu1NpC1rd3uDnNs6s1pj/DI= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -131,6 +133,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -152,6 +156,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/libproxy/proxy.go b/libproxy/proxy.go index 81f80e9..3ea3b7a 100644 --- a/libproxy/proxy.go +++ b/libproxy/proxy.go @@ -327,7 +327,7 @@ func proxyHandler(response http.ResponseWriter, request *http.Request) { responseData.Success = true responseData.Status = proxyResponse.StatusCode responseData.StatusText = strings.Join(strings.Split(proxyResponse.Status, " ")[1:], " ") - responseBytes, err := io.ReadAll(proxyResponse.Body) + responseBytes, _ := io.ReadAll(proxyResponse.Body) responseData.Headers = headerToArray(proxyResponse.Header) if requestData.WantsBinary { diff --git a/libproxy/proxy_test.go b/libproxy/proxy_test.go index c4b6d68..3214ffe 100644 --- a/libproxy/proxy_test.go +++ b/libproxy/proxy_test.go @@ -46,6 +46,7 @@ func getResult(_req Request, origin string) RespResult { func init() { allowedOrigins = []string{"validorigin1.com", "validorigin2.com"} + app := httpbin.New() testServer := httptest.NewServer(app.Handler()) testServerUrl = testServer.URL @@ -192,7 +193,7 @@ func TestPostDataJson(t *testing.T) { Method: "POST", Url: testServerUrl + "/post", Headers: map[string]string{ - "content-type": "json", + "content-type": "application/json", }, Data: `{ "string": "simple",