Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
11 changes: 11 additions & 0 deletions httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ func (this *Response) ToString() (string, error) {
return string(bytes), nil
}

func (this *Response) ToJson(v interface{}) error {
bytes, err := this.ReadAll()
if err != nil {
return err
}
if err = json.Unmarshal(bytes, v); err != nil {
return err
}
return nil
}

// Prepare a request.
func prepareRequest(method string, url_ string, headers map[string]string,
body io.Reader, options map[int]interface{}) (*http.Request, error) {
Expand Down