From f1b77d990e07b601aa5e1bb7e01d970e91952017 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:16:39 +0000 Subject: [PATCH] Bump github.com/dghubble/sling from 1.3.0 to 1.4.1 Bumps [github.com/dghubble/sling](https://github.com/dghubble/sling) from 1.3.0 to 1.4.1. - [Release notes](https://github.com/dghubble/sling/releases) - [Changelog](https://github.com/dghubble/sling/blob/main/CHANGES.md) - [Commits](https://github.com/dghubble/sling/compare/v1.3.0...v1.4.1) --- updated-dependencies: - dependency-name: github.com/dghubble/sling dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +-- vendor/github.com/dghubble/sling/.travis.yml | 12 --------- vendor/github.com/dghubble/sling/CHANGES.md | 9 +++++++ vendor/github.com/dghubble/sling/Makefile | 6 +---- vendor/github.com/dghubble/sling/README.md | 5 ++-- vendor/github.com/dghubble/sling/doc.go | 18 +++++++------- vendor/github.com/dghubble/sling/sling.go | 26 ++++++++++++++------ vendor/modules.txt | 4 +-- 9 files changed, 44 insertions(+), 42 deletions(-) delete mode 100644 vendor/github.com/dghubble/sling/.travis.yml diff --git a/go.mod b/go.mod index 16e19fb1..8101866f 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssm v1.44.7 github.com/cloudflare/cloudflare-go v0.25.0 github.com/cyberark/conjur-api-go v0.7.1 - github.com/dghubble/sling v1.3.0 + github.com/dghubble/sling v1.4.1 github.com/fatih/color v1.14.1 github.com/golang/mock v1.6.0 github.com/google/go-github/v43 v43.0.0 diff --git a/go.sum b/go.sum index d4bc7073..9636abf2 100644 --- a/go.sum +++ b/go.sum @@ -302,8 +302,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dghubble/sling v1.3.0 h1:pZHjCJq4zJvc6qVQ5wN1jo5oNZlNE0+8T/h0XeXBUKU= -github.com/dghubble/sling v1.3.0/go.mod h1:XXShWaBWKzNLhu2OxikSNFrlsvowtz4kyRuXUG7oQKY= +github.com/dghubble/sling v1.4.1 h1:AxjTubpVyozMvbBCtXcsWEyGGgUZutC5YGrfxPNVOcQ= +github.com/dghubble/sling v1.4.1/go.mod h1:QoMB1KL3GAo+7HsD8Itd6S+6tW91who8BGZzuLvpOyc= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= diff --git a/vendor/github.com/dghubble/sling/.travis.yml b/vendor/github.com/dghubble/sling/.travis.yml deleted file mode 100644 index a654faa1..00000000 --- a/vendor/github.com/dghubble/sling/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go -go: - - "1.10.x" - - "1.11.x" - - "1.12.x" -install: - - go get golang.org/x/lint/golint - - go get -v -t . -script: - - make -notifications: - email: change diff --git a/vendor/github.com/dghubble/sling/CHANGES.md b/vendor/github.com/dghubble/sling/CHANGES.md index 0abb2e51..aa00a77f 100644 --- a/vendor/github.com/dghubble/sling/CHANGES.md +++ b/vendor/github.com/dghubble/sling/CHANGES.md @@ -4,6 +4,15 @@ Notable changes between releases. ## Latest +## v1.4.1 + +* Update minimum Go version to v1.18 ([#76](https://github.com/dghubble/sling/pull/76)) + +## v1.4.0 + +* `Do` reads Body to reuse HTTP/1.x "keep-alive" TCP connections ([#59](https://github.com/dghubble/sling/pull/59)) +* `Receive` skips decoding if status is 204 (no content) ([#63](https://github.com/dghubble/sling/pull/63)) + ## v1.3.0 * Add Sling `ResponseDecoder` setter for receiving responses with a custom `ResponseDecoder` ([#49](https://github.com/dghubble/sling/pull/49)) diff --git a/vendor/github.com/dghubble/sling/Makefile b/vendor/github.com/dghubble/sling/Makefile index ca4e0698..fb990de6 100644 --- a/vendor/github.com/dghubble/sling/Makefile +++ b/vendor/github.com/dghubble/sling/Makefile @@ -1,5 +1,5 @@ .PHONY: all -all: test vet lint fmt +all: test vet fmt .PHONY: test test: @@ -9,10 +9,6 @@ test: vet: @go vet -all . -.PHONY: lint -lint: - @golint -set_exit_status ./... - .PHONY: fmt fmt: @test -z $$(go fmt ./...) diff --git a/vendor/github.com/dghubble/sling/README.md b/vendor/github.com/dghubble/sling/README.md index ff793c60..8e9d7de5 100644 --- a/vendor/github.com/dghubble/sling/README.md +++ b/vendor/github.com/dghubble/sling/README.md @@ -1,4 +1,5 @@ -# Sling [![Build Status](https://travis-ci.org/dghubble/sling.svg?branch=master)](https://travis-ci.org/dghubble/sling) [![GoDoc](https://godoc.org/github.com/dghubble/sling?status.svg)](https://godoc.org/github.com/dghubble/sling) +# Sling [![GoDoc](https://pkg.go.dev/badge/github.com/dghubble/sling.svg)](https://pkg.go.dev/github.com/dghubble/sling) [![Workflow](https://github.com/dghubble/sling/actions/workflows/test.yaml/badge.svg)](https://github.com/dghubble/sling/actions/workflows/test.yaml?query=branch%3Amain) [![Coverage](https://gocover.io/_badge/github.com/dghubble/sling)](https://gocover.io/github.com/dghubble/sling) [![Sponsors](https://img.shields.io/github/sponsors/dghubble?logo=github)](https://github.com/sponsors/dghubble) [![Twitter](https://img.shields.io/badge/twitter-follow-1da1f2?logo=twitter)](https://twitter.com/dghubble) + Sling is a Go HTTP client library for creating and sending API requests. @@ -272,10 +273,8 @@ func (s *IssueService) ListByRepo(owner, repo string, params *IssueListParams) ( * GoSquared [drinkin/go-gosquared](https://github.com/drinkin/go-gosquared) * Kala [ajvb/kala](https://github.com/ajvb/kala) * Parse [fergstar/go-parse](https://github.com/fergstar/go-parse) -* Rdio [apriendeau/shares](https://github.com/apriendeau/shares) * Swagger Generator [swagger-api/swagger-codegen](https://github.com/swagger-api/swagger-codegen) * Twitter [dghubble/go-twitter](https://github.com/dghubble/go-twitter) -* Hacker News [mirceamironenco/go-hackernews](https://github.com/mirceamironenco/go-hackernews) * Stacksmith [jesustinoco/go-smith](https://github.com/jesustinoco/go-smith) Create a Pull Request to add a link to your own API. diff --git a/vendor/github.com/dghubble/sling/doc.go b/vendor/github.com/dghubble/sling/doc.go index dd2efb7e..f48836c1 100644 --- a/vendor/github.com/dghubble/sling/doc.go +++ b/vendor/github.com/dghubble/sling/doc.go @@ -5,7 +5,7 @@ Slings store HTTP Request properties to simplify sending requests and decoding responses. Check the examples to learn how to compose a Sling into your API client. -Usage +# Usage Use a Sling to set path, method, header, query, or body properties and create an http.Request. @@ -18,7 +18,7 @@ http.Request. req, err := sling.New().Get("https://example.com").QueryStruct(params).Request() client.Do(req) -Path +# Path Use Path to set or extend the URL for created Requests. Extension means the path will be resolved relative to the existing URL. @@ -31,14 +31,14 @@ except they set the HTTP method too. req, err := sling.New().Post("http://upload.com/gophers") -Headers +# Headers Add or Set headers for requests created by a Sling. s := sling.New().Base(baseUrl).Set("User-Agent", "Gophergram API Client") req, err := s.New().Get("gophergram/list").Request() -QueryStruct +# QueryStruct Define url parameter structs (https://godoc.org/github.com/google/go-querystring/query). Use QueryStruct to encode a struct as query parameters on requests. @@ -59,7 +59,7 @@ Use QueryStruct to encode a struct as query parameters on requests. params := &IssueParams{Sort: "updated", State: "open"} req, err := githubBase.New().Get(path).QueryStruct(params).Request() -Json Body +# Json Body Define JSON tagged structs (https://golang.org/pkg/encoding/json/). Use BodyJSON to JSON encode a struct as the Body on requests. @@ -83,7 +83,7 @@ Use BodyJSON to JSON encode a struct as the Body on requests. Requests will include an "application/json" Content-Type header. -Form Body +# Form Body Define url tagged structs (https://godoc.org/github.com/google/go-querystring/query). Use BodyForm to form url encode a struct as the Body on requests. @@ -100,7 +100,7 @@ Use BodyForm to form url encode a struct as the Body on requests. Requests will include an "application/x-www-form-urlencoded" Content-Type header. -Plain Body +# Plain Body Use Body to set a plain io.Reader on requests created by a Sling. @@ -109,7 +109,7 @@ Use Body to set a plain io.Reader on requests created by a Sling. Set a content type header, if desired (e.g. Set("Content-Type", "text/plain")). -Extend a Sling +# Extend a Sling Each Sling generates an http.Request (say with some path and query params) each time Request() is called, based on its state. When creating @@ -137,7 +137,7 @@ is undesired. Recap: If you wish to extend a Sling, create a new child copy with New(). -Receive +# Receive Define a JSON struct to decode a type from 2XX success responses. Use ReceiveSuccess(successV interface{}) to send a new Request and decode the diff --git a/vendor/github.com/dghubble/sling/sling.go b/vendor/github.com/dghubble/sling/sling.go index fe9c54ec..57d7ad51 100644 --- a/vendor/github.com/dghubble/sling/sling.go +++ b/vendor/github.com/dghubble/sling/sling.go @@ -3,6 +3,7 @@ package sling import ( "encoding/base64" "io" + "io/ioutil" "net/http" "net/url" @@ -54,9 +55,9 @@ func New() *Sling { // New returns a copy of a Sling for creating a new Sling with properties // from a parent Sling. For example, // -// parentSling := sling.New().Client(client).Base("https://api.io/") -// fooSling := parentSling.New().Get("foo/") -// barSling := parentSling.New().Get("bar/") +// parentSling := sling.New().Client(client).Base("https://api.io/") +// fooSling := parentSling.New().Get("foo/") +// barSling := parentSling.New().Get("bar/") // // fooSling and barSling will both use the same client, but send requests to // https://api.io/foo/ and https://api.io/bar/ respectively. @@ -359,8 +360,9 @@ func (s *Sling) ReceiveSuccess(successV interface{}) (*http.Response, error) { // Receive creates a new HTTP request and returns the response. Success // responses (2XX) are JSON decoded into the value pointed to by successV and // other responses are JSON decoded into the value pointed to by failureV. -// Any error creating the request, sending it, or decoding the response is -// returned. +// If the status code of response is 204(no content) or the Content-Lenght is 0, +// decoding is skipped. Any error creating the request, sending it, or decoding +// the response is returned. // Receive is shorthand for calling Request and Do. func (s *Sling) Receive(successV, failureV interface{}) (*http.Response, error) { req, err := s.Request() @@ -373,7 +375,9 @@ func (s *Sling) Receive(successV, failureV interface{}) (*http.Response, error) // Do sends an HTTP request and returns the response. Success responses (2XX) // are JSON decoded into the value pointed to by successV and other responses // are JSON decoded into the value pointed to by failureV. -// Any error sending the request or decoding the response is returned. +// If the status code of response is 204(no content) or the Content-Length is 0, +// decoding is skipped. Any error sending the request or decoding the response +// is returned. func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Response, error) { resp, err := s.httpClient.Do(req) if err != nil { @@ -382,8 +386,14 @@ func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Res // when err is nil, resp contains a non-nil resp.Body which must be closed defer resp.Body.Close() - // Don't try to decode on 204s - if resp.StatusCode == 204 { + // The default HTTP client's Transport may not + // reuse HTTP/1.x "keep-alive" TCP connections if the Body is + // not read to completion and closed. + // See: https://golang.org/pkg/net/http/#Response + defer io.Copy(ioutil.Discard, resp.Body) + + // Don't try to decode on 204s or Content-Length is 0 + if resp.StatusCode == http.StatusNoContent || resp.ContentLength == 0 { return resp, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index e3a268a8..572ac8f2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -313,8 +313,8 @@ github.com/danieljoos/wincred # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/dghubble/sling v1.3.0 -## explicit; go 1.12 +# github.com/dghubble/sling v1.4.1 +## explicit; go 1.18 github.com/dghubble/sling # github.com/dimchansky/utfbom v1.1.1 ## explicit