Skip to content
Snippets Groups Projects
Commit 0df6719e authored by Will McCutchen's avatar Will McCutchen
Browse files

Make sure request data is a JSON string instead of a []byte

parent 70bd01d6
No related branches found
No related tags found
No related merge requests found
......@@ -502,7 +502,9 @@ func TestPost__JSON(t *testing.T) {
t.Fatalf("failed to unmarshal body %s from JSON: %s", w.Body, err)
}
assertBytesEqual(t, resp.Data, inputBody)
if resp.Data != string(inputBody) {
t.Fatalf("expected data == %#v, got %#v", string(inputBody), resp.Data)
}
if len(resp.Args) > 0 {
t.Fatalf("expected no query params, got %#v", resp.Args)
}
......
......@@ -87,7 +87,7 @@ func parseBody(w http.ResponseWriter, r *http.Request, resp *bodyResponse) error
r.Body.Close()
return err
}
resp.Data = body
resp.Data = string(body)
// After reading the body to populate resp.Data, we need to re-wrap it in
// an io.Reader for further processing below
......
......@@ -41,7 +41,7 @@ type bodyResponse struct {
Origin string `json:"origin"`
URL string `json:"url"`
Data []byte `json:"data"`
Data string `json:"data"`
Files map[string][]string `json:"files"`
Form map[string][]string `json:"form"`
JSON interface{} `json:"json"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment