Skip to content

Commit 16516f5

Browse files
author
Karolis Rusenas
committed
Merge pull request #4 from SpectoLabs/develop
storing requests as strings rather than bytes
2 parents 0c02864 + 469eaa7 commit 16516f5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

models.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (r *request) hash() string {
4747
// by the client.
4848
type response struct {
4949
Status int `json:"status"`
50-
Body []byte `json:"body"`
50+
Body string `json:"body"`
5151
Headers map[string][]string `json:"headers"`
5252
}
5353

@@ -122,9 +122,8 @@ func (d *DBClient) save(req *http.Request, resp *http.Response, respBody []byte)
122122
resp = emptyResp
123123
} else {
124124
responseObj := response{
125-
Status: resp.StatusCode,
126-
Body: respBody,
127-
// Headers: getHeadersMap(resp.Header),
125+
Status: resp.StatusCode,
126+
Body: string(respBody),
128127
Headers: resp.Header,
129128
}
130129

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

0 commit comments

Comments
 (0)