diff --git a/_research/ws_client/index.html b/_research/ws_client/index.html index f0c88d4..a172391 100644 --- a/_research/ws_client/index.html +++ b/_research/ws_client/index.html @@ -24,6 +24,7 @@ $("#send").click(function() { sock.send(JSON.stringify({ + type: "request", id: "random id", method: $("#method").val(), path: $("#path").val(), @@ -32,7 +33,7 @@ }); sock.onmessage = function(e) { - console.log(JSON.parse(e.data)); + console.log(e.data); }; }); diff --git a/setup/setup.go b/setup/setup.go index 5549c6c..06219d0 100644 --- a/setup/setup.go +++ b/setup/setup.go @@ -612,11 +612,11 @@ func PrepareMux(flags *env.Flags) *web.Mux { // Return the final response result, _ := json.Marshal(map[string]interface{}{ - "type": "response", - "id": input.ID, - "status": w.Code, - "header": w.HeaderMap, - "body": w.Body.String(), + "type": "response", + "id": input.ID, + "status": w.Code, + "headers": w.HeaderMap, + "body": w.Body.String(), }) err = session.Send(string(result)) if err != nil {