From af2fa35d6ded7f40a76eb553d670e28f35420792 Mon Sep 17 00:00:00 2001 From: Jeevanandam M Date: Wed, 30 Sep 2015 16:29:54 -0700 Subject: [PATCH] Improved code with Lint suggestion and readme update --- README.md | 8 ++++++-- client.go | 6 +++--- default.go | 4 ++-- redirect.go | 2 +- resty.go | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f36cdee3..5bfc4f8b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # resty [![Build Status](https://travis-ci.org/go-resty/resty.svg?branch=master)](https://travis-ci.org/go-resty/resty) [![GoCover](http://gocover.io/_badge/github.com/go-resty/resty)](http://gocover.io/github.com/go-resty/resty) [![GoDoc](https://godoc.org/github.com/go-resty/resty?status.svg)](https://godoc.org/github.com/go-resty/resty) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) -Simple HTTP and REST client for Go inspired by Ruby rest-client. +Simple HTTP and REST client for Go inspired by Ruby rest-client. Provides notable features - robust request body input, auto marshal & unmarshal, request and response middlewares, custom & extensible redirect policy (multiple policies can be applied), etc. #### Features * Get, Post, Put, Delete, Head, Patch and Options @@ -33,7 +33,11 @@ Simple HTTP and REST client for Go inspired by Ruby rest-client. resty tested with Go 1.2 and above. #### Included Batteries - * Redirect Policies - NoRedirectPolicy, FlexibleRedirectPolicy, DomainCheckRedirectPolicy, etc. [more info](redirect.go) + * Redirect Policies + * NoRedirectPolicy + * FlexibleRedirectPolicy + * DomainCheckRedirectPolicy + * etc. [more info](redirect.go) * Write Cookies to file from CookiesJar (upcoming) * etc. diff --git a/client.go b/client.go index cf930ee6..6b6fa44a 100644 --- a/client.go +++ b/client.go @@ -475,11 +475,11 @@ func (c *Client) SetTimeout(timeout time.Duration) *Client { // Alternative: Without this `SetProxy` method, you can also set Proxy via environment variable. // By default `Go` uses setting from `HTTP_PROXY`. // -func (c *Client) SetProxy(proxyUrl string) *Client { - if pURL, err := url.Parse(proxyUrl); err == nil { +func (c *Client) SetProxy(proxyURL string) *Client { + if pURL, err := url.Parse(proxyURL); err == nil { c.transport.Proxy = http.ProxyURL(pURL) } else { - c.Log.Printf("ERROR: %s", err) + c.Log.Printf("ERROR: %v", err) } return c diff --git a/default.go b/default.go index 20a1bbe6..bc5616b4 100644 --- a/default.go +++ b/default.go @@ -183,8 +183,8 @@ func SetTimeout(timeout time.Duration) *Client { } // SetProxy method sets Proxy for request. See Client.SetProxy for more information. -func SetProxy(proxyUrl string) *Client { - return DefaultClient.SetProxy(proxyUrl) +func SetProxy(proxyURL string) *Client { + return DefaultClient.SetProxy(proxyURL) } // RemoveProxy method removes the proxy configuration. See Client.RemoveProxy for more information. diff --git a/redirect.go b/redirect.go index 70efcf38..bfe7cff0 100644 --- a/redirect.go +++ b/redirect.go @@ -12,8 +12,8 @@ import ( "strings" ) +// RedirectPolicy to regulate the redirects in the resty client. // Objects implementing the RedirectPolicy interface can be registered as -// RedirectPolicy to regulate the redirects in the resty. // // Apply function should return nil to continue the redirect jounery, otherwise // return error to stop the redirect. diff --git a/resty.go b/resty.go index 7fd09722..ace72584 100644 --- a/resty.go +++ b/resty.go @@ -9,4 +9,4 @@ Package resty provides simple HTTP and REST client for Go inspired by Ruby rest- package resty // go-resty version no -var Version = "0.1" +var Version = "0.2.1"