From 9e38a8ceb7e5154bb66c4157bf8eadc6fcf7b58f Mon Sep 17 00:00:00 2001 From: Joel Unzain Date: Fri, 21 May 2021 15:00:52 -0700 Subject: [PATCH 1/2] use latest version of httpaux --- go.mod | 2 +- go.sum | 2 ++ store/dynamodb/db.go | 4 ++-- store/errors.go | 8 ++++---- store/transport_test.go | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index c4619e26..d36e9fcb 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/xmidt-org/bascule v0.9.1-0.20210506212507-4df8762472bc github.com/xmidt-org/candlelight v0.0.5 - github.com/xmidt-org/httpaux v0.1.3 + github.com/xmidt-org/httpaux v0.2.1 github.com/xmidt-org/themis v0.4.7 github.com/xmidt-org/webpa-common v1.11.7 go.uber.org/fx v1.13.1 diff --git a/go.sum b/go.sum index 894c971c..735c7305 100644 --- a/go.sum +++ b/go.sum @@ -722,6 +722,8 @@ github.com/xmidt-org/candlelight v0.0.5/go.mod h1:j9Q2tzrOAywm+JvvVJjlOmlPJvdlRr github.com/xmidt-org/httpaux v0.1.2/go.mod h1:qZnH2uObGPwHnOz8HcPNlbcd3gKEvdmxbIK3rgbQhto= github.com/xmidt-org/httpaux v0.1.3 h1:RiA4pCwlZfu6a3CBzbvJy3F+5no1ou2UB2XLmNxzzUs= github.com/xmidt-org/httpaux v0.1.3/go.mod h1:mviIlg5fHGb3lAv3l0sbiwVG/q9rqvXaudEYxVrzXdE= +github.com/xmidt-org/httpaux v0.2.1 h1:SFK+Bab5c6r70VxMfJcDR49aBHIUs0uQJruC+nMpAcg= +github.com/xmidt-org/httpaux v0.2.1/go.mod h1:mviIlg5fHGb3lAv3l0sbiwVG/q9rqvXaudEYxVrzXdE= github.com/xmidt-org/themis v0.4.4 h1:KewitRxStW1xOehDBi0YyGZyRv3PjFdYUEDvQFf1Nmk= github.com/xmidt-org/themis v0.4.4/go.mod h1:0qRYFvKdrQhwjxH/1nAiTgBGT4cegJR76gfEYF5P7so= github.com/xmidt-org/themis v0.4.7 h1:QAbutfysHG/UhVNzPAvWsEQIdZY0oNz9KYIkAaK7aus= diff --git a/store/dynamodb/db.go b/store/dynamodb/db.go index b12f5a02..ece80910 100644 --- a/store/dynamodb/db.go +++ b/store/dynamodb/db.go @@ -30,7 +30,7 @@ import ( "github.com/xmidt-org/argus/model" "github.com/xmidt-org/argus/store" "github.com/xmidt-org/argus/store/db/metric" - "github.com/xmidt-org/httpaux" + "github.com/xmidt-org/httpaux/erraux" "github.com/xmidt-org/themis/config" ) @@ -45,7 +45,7 @@ const ( var validate *validator.Validate -var errHTTPBadRequest = &httpaux.Error{ +var errHTTPBadRequest = &erraux.Error{ Err: errors.New("bad request to dynamodb"), Code: http.StatusBadRequest, } diff --git a/store/errors.go b/store/errors.go index 2a5d5d99..3be753d3 100644 --- a/store/errors.go +++ b/store/errors.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/xmidt-org/argus/model" - "github.com/xmidt-org/httpaux" + "github.com/xmidt-org/httpaux/erraux" ) // Sentinel internal errors. @@ -19,8 +19,8 @@ var ( // Sentinel errors to be used by the HTTP response error encoder. var ( - ErrHTTPItemNotFound = &httpaux.Error{Err: errors.New("Item not found"), Code: http.StatusNotFound} - ErrHTTPOpFailed = &httpaux.Error{Err: errors.New("DB operation failed"), Code: http.StatusInternalServerError} + ErrHTTPItemNotFound = &erraux.Error{Err: errors.New("Item not found"), Code: http.StatusNotFound} + ErrHTTPOpFailed = &erraux.Error{Err: errors.New("DB operation failed"), Code: http.StatusInternalServerError} ) type sanitizedErrorer interface { @@ -40,7 +40,7 @@ type SanitizedError struct { // of Err that can be safely used across API boundaries. // Two use cases include: hiding sensitive error data and // translating errors to better explain error events to API consumers. - ErrHTTP *httpaux.Error + ErrHTTP *erraux.Error } func (s SanitizedError) Unwrap() error { diff --git a/store/transport_test.go b/store/transport_test.go index 80c7176b..8f94a6f8 100644 --- a/store/transport_test.go +++ b/store/transport_test.go @@ -18,7 +18,7 @@ import ( "github.com/xmidt-org/argus/auth" "github.com/xmidt-org/argus/model" "github.com/xmidt-org/bascule" - "github.com/xmidt-org/httpaux" + "github.com/xmidt-org/httpaux/erraux" ) func TestEncodeError(t *testing.T) { @@ -33,7 +33,7 @@ func TestEncodeError(t *testing.T) { Description: "Headers and code", InputErr: SanitizedError{ Err: errors.New("internal ignored err"), - ErrHTTP: &httpaux.Error{ + ErrHTTP: &erraux.Error{ Err: errHTTPMsg, Code: http.StatusBadRequest, Header: http.Header{"X-Some-Header": []string{"val0", "val1"}}, From 975a4a04486626f07931d57113205912d24c6645 Mon Sep 17 00:00:00 2001 From: Joel Unzain Date: Fri, 21 May 2021 15:01:49 -0700 Subject: [PATCH 2/2] add release note --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 775ca61a..0c79c823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] - Add URLParse Option to auth package. [#179](https://github.com/xmidt-org/argus/pull/179) +- Use latest version of httpaux. [#180](https://github.com/xmidt-org/argus/pull/180) ## [v0.3.16] - Allow auth package client code to pass the basculehttp.OnErrorHTTPResponse option. [#174](https://github.com/xmidt-org/argus/pull/174)