-
-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from go-resty/for-2.6.0-release
- Loading branch information
Showing
22 changed files
with
52 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015-2020 Jeevanandam M., https://myjeeva.com <[email protected]> | ||
Copyright (c) 2015-2021 Jeevanandam M., https://myjeeva.com <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
@@ -202,6 +202,8 @@ func (c *Client) SetHeaders(headers map[string]string) *Client { | |
// SetHeaderVerbatim("UPPERCASE", "available") | ||
// | ||
// Also you can override header value, which was set at client instance level. | ||
// | ||
// Since v2.6.0 | ||
func (c *Client) SetHeaderVerbatim(header, value string) *Client { | ||
c.Header[header] = []string{value} | ||
return c | ||
|
@@ -594,19 +596,19 @@ func (c *Client) AddRetryCondition(condition RetryConditionFunc) *Client { | |
|
||
// AddRetryAfterErrorCondition adds the basic condition of retrying after encountering | ||
// an error from the http response | ||
// | ||
// Since v2.6.0 | ||
func (c *Client) AddRetryAfterErrorCondition() *Client { | ||
c.AddRetryCondition(func(response *Response, err error) bool { | ||
if response.IsError() { | ||
return true | ||
} | ||
|
||
return false | ||
return response.IsError() | ||
}) | ||
return c | ||
} | ||
|
||
// AddRetryHook adds a side-effecting retry hook to an array of hooks | ||
// that will be executed on each retry. | ||
// | ||
// Since v2.6.0 | ||
func (c *Client) AddRetryHook(hook OnRetryFunc) *Client { | ||
c.RetryHooks = append(c.RetryHooks, hook) | ||
return c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
@@ -261,8 +261,8 @@ func TestClientSetHeaderVerbatim(t *testing.T) { | |
SetHeaderVerbatim("header-lowercase", "value_lowercase"). | ||
SetHeader("header-lowercase", "value_standard") | ||
|
||
assertEqual(t, "value_lowercase", strings.Join(c.Header["header-lowercase"], "")) | ||
assertEqual(t, "value_standard", strings.Join(c.Header["Header-Lowercase"], "")) | ||
assertEqual(t, "value_lowercase", strings.Join(c.Header["header-lowercase"], "")) //nolint | ||
assertEqual(t, "value_standard", c.Header.Get("Header-Lowercase")) | ||
} | ||
|
||
func TestClientSetTransport(t *testing.T) { | ||
|
@@ -366,11 +366,7 @@ func TestClientOptions(t *testing.T) { | |
|
||
client.AddRetryAfterErrorCondition() | ||
equal(client.RetryConditions[0], func(response *Response, err error) bool { | ||
if response.IsError() { | ||
return true | ||
} | ||
|
||
return false | ||
return response.IsError() | ||
}) | ||
|
||
err := &AuthError{} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]) | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]) | ||
// 2016 Andrew Grigorev (https://github.com/ei-grad) | ||
// All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M. ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M. ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module github.com/go-resty/resty/v2 | ||
|
||
require golang.org/x/net v0.0.0-20201224014010-6772e930b67b | ||
require golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 | ||
|
||
go 1.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw= | ||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= | ||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= | ||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
@@ -125,6 +125,8 @@ func (r *Request) SetHeaders(headers map[string]string) *Request { | |
// SetHeaderVerbatim("UPPERCASE", "available") | ||
// | ||
// Also you can override header value, which was set at client instance level. | ||
// | ||
// Since v2.6.0 | ||
func (r *Request) SetHeaderVerbatim(header, value string) *Request { | ||
r.Header[header] = []string{value} | ||
return r | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
@@ -1367,11 +1367,10 @@ func TestSetHeaderVerbatim(t *testing.T) { | |
SetHeaderVerbatim("header-lowercase", "value_lowercase"). | ||
SetHeader("header-lowercase", "value_standard") | ||
|
||
assertEqual(t, "value_lowercase", strings.Join(r.Header["header-lowercase"], "")) | ||
assertEqual(t, "value_standard", strings.Join(r.Header["Header-Lowercase"], "")) | ||
assertEqual(t, "value_lowercase", strings.Join(r.Header["header-lowercase"], "")) //nolint | ||
assertEqual(t, "value_standard", r.Header.Get("Header-Lowercase")) | ||
} | ||
|
||
|
||
func TestOutputFileWithBaseDirAndRelativePath(t *testing.T) { | ||
ts := createGetServer(t) | ||
defer ts.Close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
@@ -14,7 +14,7 @@ import ( | |
) | ||
|
||
// Version # of resty | ||
const Version = "2.6.0-dev" | ||
const Version = "2.6.0" | ||
|
||
// New method creates a new Resty client. | ||
func New() *Client { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// +build go1.13 | ||
|
||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// +build !go1.13 | ||
|
||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// Copyright (c) 2015-2021 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
|