Skip to content

Commit

Permalink
Merge pull request #4 from SpectoLabs/develop
Browse files Browse the repository at this point in the history
storing requests as strings rather than bytes
  • Loading branch information
Karolis Rusenas committed Dec 1, 2015
2 parents 0c02864 + 469eaa7 commit 16516f5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (r *request) hash() string {
// by the client.
type response struct {
Status int `json:"status"`
Body []byte `json:"body"`
Body string `json:"body"`
Headers map[string][]string `json:"headers"`
}

Expand Down Expand Up @@ -122,9 +122,8 @@ func (d *DBClient) save(req *http.Request, resp *http.Response, respBody []byte)
resp = emptyResp
} else {
responseObj := response{
Status: resp.StatusCode,
Body: respBody,
// Headers: getHeadersMap(resp.Header),
Status: resp.StatusCode,
Body: string(respBody),
Headers: resp.Header,
}

Expand Down Expand Up @@ -278,7 +277,7 @@ func (d *DBClient) getResponse(req *http.Request) *http.Response {
}
newResponse.Header.Set("Gen-Proxy", "Playback")
// adding body
buf := bytes.NewBuffer(payload.Response.Body)
buf := bytes.NewBufferString(payload.Response.Body)
newResponse.ContentLength = int64(buf.Len())
newResponse.Body = ioutil.NopCloser(buf)

Expand Down

0 comments on commit 16516f5

Please sign in to comment.