Skip to content

Commit 00cb083

Browse files
authored
#119 trailing slash fix and release version update (#120)
1 parent b8d3265 commit 00cb083

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Resty [![Build Status](https://travis-ci.org/go-resty/resty.svg?branch=master)](https://travis-ci.org/go-resty/resty) [![codecov](https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg)](https://codecov.io/gh/go-resty/resty/branch/master) [![GoReport](https://goreportcard.com/badge/go-resty/resty)](https://goreportcard.com/report/go-resty/resty) [![Version](https://img.shields.io/badge/version-1.1-blue.svg)](https://github.com/go-resty/resty/releases/latest) [![GoDoc](https://godoc.org/github.com/go-resty/resty?status.svg)](https://godoc.org/github.com/go-resty/resty) [![License](https://img.shields.io/github/license/go-resty/resty.svg)](LICENSE)
1+
# Resty [![Build Status](https://travis-ci.org/go-resty/resty.svg?branch=master)](https://travis-ci.org/go-resty/resty) [![codecov](https://codecov.io/gh/go-resty/resty/branch/master/graph/badge.svg)](https://codecov.io/gh/go-resty/resty/branch/master) [![GoReport](https://goreportcard.com/badge/go-resty/resty)](https://goreportcard.com/report/go-resty/resty) [![Version](https://img.shields.io/badge/version-1.2-blue.svg)](https://github.com/go-resty/resty/releases/latest) [![GoDoc](https://godoc.org/github.com/go-resty/resty?status.svg)](https://godoc.org/github.com/go-resty/resty) [![License](https://img.shields.io/github/license/go-resty/resty.svg)](LICENSE)
22

33
Simple HTTP and REST client for Go inspired by Ruby rest-client. [Features](#features) section describes in detail about Resty capabilities.
44

5-
***v1.1 [released](https://github.com/go-resty/resty/releases/latest) and tagged on Jan 25, 2018.***
5+
***v1.2 [released](https://github.com/go-resty/resty/releases/latest) and tagged on Jan 26, 2018.***
66

77
*Since Go v1.6 HTTP/2 & HTTP/1.1 protocol is used transparently. `Resty` works fine with HTTP/2 and HTTP/1.1.*
88

resty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
package resty
77

88
// Version # of resty
9-
const Version = "1.2-edge"
9+
const Version = "1.2"

util.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ func composeRequestURL(pathURL string, c *Client, r *Request) string {
211211
pathURL = "/" + pathURL
212212
}
213213

214+
hasTrailingSlash := false
215+
if strings.HasSuffix(pathURL, "/") && len(pathURL) > 1 {
216+
hasTrailingSlash = true
217+
}
218+
214219
reqURL := "/"
215220
for _, segment := range strings.Split(pathURL, "/") {
216221
if strings.HasPrefix(segment, "{") && strings.HasSuffix(segment, "}") {
@@ -229,5 +234,9 @@ func composeRequestURL(pathURL string, c *Client, r *Request) string {
229234
reqURL = path.Join(reqURL, segment)
230235
}
231236

237+
if hasTrailingSlash {
238+
reqURL = reqURL + "/"
239+
}
240+
232241
return reqURL
233242
}

0 commit comments

Comments
 (0)