jeudi 18 février 2016

The fomat of response body when adding new map in WireMock

I was starting playing with WireMock and trying mock an API, so I need to add new mapping to mock first, create new json file with the following content:

    {
    "request":
    {
        "urlPattern": "/user/1",
        "method": "GET"
    },

    "response":
    {
        "status": 200,
        "headers":
        {
            "Content-Type": "application/json"
        },
        "body": "{\"id\": \"1\", \"login\": \"test\", \"www\": \"www.test.com\"}"
    }
}

Then my question comes, should the format body format more tidy, like:

"body": "{"id": 1}"

In this way, I think it's more convenient for testing. Or the body must be set in this way? Is there any other options or tricks to complete it ?

Thanks a lot.

Aucun commentaire:

Enregistrer un commentaire