Skip to content

Commit

Permalink
Merge branch 'release/v0.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
parnurzeal committed Feb 8, 2015
2 parents 6babf29 + ea4f73f commit 774aba9
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 159 deletions.
28 changes: 19 additions & 9 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
Changelog
=========

v0.2.3 (2015-02-08)

Features
* Added Patch HTTP Method

Bug/Fixes
* Refactored testing code

v0.2.2 (2015-01-03)
Features
* Added TLSClientConfig for better control over tls
* Added AddCookie func to set "Cookie" field in request (pull request by
@austinov) - Issue #7
* Added CookieJar (pull request by @kemadz)

Features
* Added TLSClientConfig for better control over tls
* Added AddCookie func to set "Cookie" field in request (pull request by @austinov) - Issue #7
* Added CookieJar (pull request by @kemadz)

v0.2.1 (2014-07-06)
Features
* Implemented timeout test
Bugs/Fixes
* Improved timeout feature by control over both dial + read/write timeout compared to previously controlling only dial connection timeout.

Features
* Implemented timeout test

Bugs/Fixes
* Improved timeout feature by control over both dial + read/write timeout compared to previously controlling only dial connection timeout.

v0.2.0 (2014-06-13) - Send is now supporting Struct type as a parameter

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GoRequest -- Simplified HTTP client ( inspired by famous SuperAgent lib in Node.

Sending request would never been fun and easier than this. It comes with lots of feature:

* Get/Post/Put/Head/Delete
* Get/Post/Put/Head/Delete/Patch
* Set - simple header setting
* JSON - made it simple with JSON string as a parameter
* Proxy - sending request via proxy
Expand Down
29 changes: 0 additions & 29 deletions error_test.go

This file was deleted.

11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
HEAD = "HEAD"
PUT = "PUT"
DELETE = "DELETE"
PATCH = "PATCH"
)

// A SuperAgent is a object storing all request data for client.
Expand Down Expand Up @@ -120,6 +121,14 @@ func (s *SuperAgent) Delete(targetUrl string) *SuperAgent {
return s
}

func (s *SuperAgent) Patch(targetUrl string) *SuperAgent {
s.ClearSuperAgent()
s.Method = PATCH
s.Url = targetUrl
s.Errors = nil
return s
}

// Set is used for setting header fields.
// Example. To set `Accept` as `application/json`
//
Expand Down Expand Up @@ -448,7 +457,7 @@ func (s *SuperAgent) End(callback ...func(response Response, body string, errs [
}

switch s.Method {
case POST, PUT:
case POST, PUT, PATCH:
if s.TargetType == "json" {
contentJson, _ := json.Marshal(s.Data)
contentReader := bytes.NewReader(contentJson)
Expand Down

0 comments on commit 774aba9

Please sign in to comment.