diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..13b025b6
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,41 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ branches:
+ - master
+ paths-ignore:
+ - '**.md'
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ build:
+ name: Build
+ strategy:
+ matrix:
+ go: [ '1.17.x', '1.16.x' ]
+ os: [ ubuntu-latest ]
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Setup Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: ${{ matrix.go }}
+
+ - name: Test
+ run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic
+
+ - name: Coverage
+ run: bash <(curl -s https://codecov.io/bash)
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index d6f15f85..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: go
-
-os: linux
-
-if: (branch = master) OR (type = pull_request)
-
-go: # use travis ci resource effectively, keep always latest 2 versions
- - 1.17.x
- - 1.16.x
-
-install:
- - go get -v -t ./...
-
-script:
- - go test ./... -race -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
diff --git a/README.md b/README.md
index 2088cc38..1b2b1b4d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
Features section describes in detail about Resty capabilities
-
+
Resty Communication Channels
diff --git a/client.go b/client.go
index f68d0547..eb12f086 100644
--- a/client.go
+++ b/client.go
@@ -92,7 +92,8 @@ type (
// Resty also provides an options to override most of the client settings
// at request level.
type Client struct {
- HostURL string
+ BaseURL string
+ HostURL string // Deprecated: use BaseURL instead. To be removed in v3.0.0 release.
QueryParam url.Values
FormData url.Values
Header http.Header
@@ -154,8 +155,25 @@ type User struct {
//
// // Setting HTTPS address
// client.SetHostURL("https://myjeeva.com")
+//
+// Deprecated: use SetBaseURL instead. To be removed in v3.0.0 release.
func (c *Client) SetHostURL(url string) *Client {
- c.HostURL = strings.TrimRight(url, "/")
+ c.SetBaseURL(url)
+ return c
+}
+
+// SetBaseURL method is to set Base URL in the client instance. It will be used with request
+// raised from this client with relative URL
+// // Setting HTTP address
+// client.SetBaseURL("http://myjeeva.com")
+//
+// // Setting HTTPS address
+// client.SetBaseURL("https://myjeeva.com")
+//
+// Since v2.7.0
+func (c *Client) SetBaseURL(url string) *Client {
+ c.BaseURL = strings.TrimRight(url, "/")
+ c.HostURL = c.BaseURL
return c
}
diff --git a/request.go b/request.go
index 52166e69..1cd42cf7 100644
--- a/request.go
+++ b/request.go
@@ -599,6 +599,8 @@ func (r *Request) SetCookies(rs []*http.Cookie) *Request {
// The request will retry if any of the functions return true and error is nil.
//
// Note: These retry conditions are checked before all retry conditions of the client.
+//
+// Since v2.7.0
func (r *Request) AddRetryCondition(condition RetryConditionFunc) *Request {
r.retryConditions = append(r.retryConditions, condition)
return r