Fix route_add{,_test}.go to use an io.Writer for saving the response

Also add a TODO regarding untested response payload.

Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
This commit is contained in:
pancho horrillo
2019-10-04 06:28:17 +02:00
parent 219710bb76
commit b9bf78abf4
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -21,7 +21,10 @@ func TestSuccessOnCorrectRoute(t *testing.T) {
Reply(http.StatusCreated).
JSON(map[string]string{})
err := AddRoute("http://localhost", "/hello", "GET", "", "echo Hello World | kapow set /response/body")
// TODO: As per the spec¹, the call should return a JSON body with the info of the new route
// We should consider this in the mocked server and in the test
// ¹: https://github.com/BBVA/kapow/tree/master/spec#insert-a-route
err := AddRoute("http://localhost", "/hello", "GET", "", "echo Hello World | kapow set /response/body", nil)
if err != nil {
t.Errorf("Unexpected error: %s", err)
}