使用wiremock使用curl命令获取API的响应

时间:2016-05-23 18:27:23

标签: curl wiremock

我有以下请求和响应内容。

REQUEST

HTTP/1.1 POST /identity/v1/users
Content‐Type: application/json
Accept: application/json
{
"firstName" : "foo", "lastName" : "bar", "email" : "test@test.com", "password" : "secret123ABC"
}

RESPONSE

HTTP/1.1 201 Created

{"id":111985014}

我试图使用curl命令来获取响应,但我得到了不同的错误,并且不明白该怎么做。如果有人知道,请帮忙。

1 个答案:

答案 0 :(得分:0)

试试这个:

curl -XPOST http://<your-domain>/identity/v1/users -H "Content‐Type: application/json" -H "Accept: application/json" -d '{"firstName" : "foo", "lastName" : "bar", "email" : "test@test.com", "password" : "secret123ABC"}'