Skip to content

Commit eb1e112

Browse files
authored
Merge pull request #480 from go-resty/ehancements
2 parents 1792d62 + 9e8f2ba commit eb1e112

File tree

5 files changed

+64
-21
lines changed

5 files changed

+64
-21
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
branches:
11+
- master
12+
paths-ignore:
13+
- '**.md'
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
name: Build
21+
strategy:
22+
matrix:
23+
go: [ '1.17.x', '1.16.x' ]
24+
os: [ ubuntu-latest ]
25+
26+
runs-on: ${{ matrix.os }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
- name: Setup Go
33+
uses: actions/setup-go@v2
34+
with:
35+
go-version: ${{ matrix.go }}
36+
37+
- name: Test
38+
run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic
39+
40+
- name: Coverage
41+
run: bash <(curl -s https://codecov.io/bash)

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p align="center"><a href="#features">Features</a> section describes in detail about Resty capabilities</p>
55
</p>
66
<p align="center">
7-
<p align="center"><a href="https://travis-ci.org/go-resty/resty"><img src="https://travis-ci.org/go-resty/resty.svg?branch=master" alt="Build Status"></a> <a href="https://codecov.io/gh/go-resty/resty/branch/master"><img src="https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.6.0-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
7+
<p align="center"><a href="#"><img src="https://github.com/go-resty/resty/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a> <a href="https://codecov.io/gh/go-resty/resty/branch/master"><img src="https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg" alt="Code Coverage"></a> <a href="https://goreportcard.com/report/go-resty/resty"><img src="https://goreportcard.com/badge/go-resty/resty" alt="Go Report Card"></a> <a href="https://github.com/go-resty/resty/releases/latest"><img src="https://img.shields.io/badge/version-2.6.0-blue.svg" alt="Release Version"></a> <a href="https://pkg.go.dev/github.com/go-resty/resty/v2"><img src="https://pkg.go.dev/badge/github.com/go-resty/resty" alt="GoDoc"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/go-resty/resty.svg" alt="License"></a> <a href="https://github.com/avelino/awesome-go"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome Go"></a></p>
88
</p>
99
<p align="center">
1010
<h4 align="center">Resty Communication Channels</h4>

client.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ type (
9292
// Resty also provides an options to override most of the client settings
9393
// at request level.
9494
type Client struct {
95-
HostURL string
95+
BaseURL string
96+
HostURL string // Deprecated: use BaseURL instead. To be removed in v3.0.0 release.
9697
QueryParam url.Values
9798
FormData url.Values
9899
Header http.Header
@@ -154,8 +155,25 @@ type User struct {
154155
//
155156
// // Setting HTTPS address
156157
// client.SetHostURL("https://myjeeva.com")
158+
//
159+
// Deprecated: use SetBaseURL instead. To be removed in v3.0.0 release.
157160
func (c *Client) SetHostURL(url string) *Client {
158-
c.HostURL = strings.TrimRight(url, "/")
161+
c.SetBaseURL(url)
162+
return c
163+
}
164+
165+
// SetBaseURL method is to set Base URL in the client instance. It will be used with request
166+
// raised from this client with relative URL
167+
// // Setting HTTP address
168+
// client.SetBaseURL("http://myjeeva.com")
169+
//
170+
// // Setting HTTPS address
171+
// client.SetBaseURL("https://myjeeva.com")
172+
//
173+
// Since v2.7.0
174+
func (c *Client) SetBaseURL(url string) *Client {
175+
c.BaseURL = strings.TrimRight(url, "/")
176+
c.HostURL = c.BaseURL
159177
return c
160178
}
161179

request.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ func (r *Request) SetCookies(rs []*http.Cookie) *Request {
599599
// The request will retry if any of the functions return true and error is nil.
600600
//
601601
// Note: These retry conditions are checked before all retry conditions of the client.
602+
//
603+
// Since v2.7.0
602604
func (r *Request) AddRetryCondition(condition RetryConditionFunc) *Request {
603605
r.retryConditions = append(r.retryConditions, condition)
604606
return r

0 commit comments

Comments
 (0)