diff --git a/README.md b/README.md index 182727a3..911ae522 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# 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) +# 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) Simple HTTP and REST client for Go inspired by Ruby rest-client. [Features](#features) section describes in detail about Resty capabilities. -***v1.1 [released](https://github.com/go-resty/resty/releases/latest) and tagged on Jan 25, 2018.*** +***v1.2 [released](https://github.com/go-resty/resty/releases/latest) and tagged on Jan 26, 2018.*** *Since Go v1.6 HTTP/2 & HTTP/1.1 protocol is used transparently. `Resty` works fine with HTTP/2 and HTTP/1.1.* diff --git a/resty.go b/resty.go index b3fb1595..a8e96ab7 100644 --- a/resty.go +++ b/resty.go @@ -6,4 +6,4 @@ package resty // Version # of resty -const Version = "1.2-edge" +const Version = "1.2" diff --git a/util.go b/util.go index edf81d2b..1aa3397d 100644 --- a/util.go +++ b/util.go @@ -211,6 +211,11 @@ func composeRequestURL(pathURL string, c *Client, r *Request) string { pathURL = "/" + pathURL } + hasTrailingSlash := false + if strings.HasSuffix(pathURL, "/") && len(pathURL) > 1 { + hasTrailingSlash = true + } + reqURL := "/" for _, segment := range strings.Split(pathURL, "/") { if strings.HasPrefix(segment, "{") && strings.HasSuffix(segment, "}") { @@ -229,5 +234,9 @@ func composeRequestURL(pathURL string, c *Client, r *Request) string { reqURL = path.Join(reqURL, segment) } + if hasTrailingSlash { + reqURL = reqURL + "/" + } + return reqURL }