96 lines
2.4 KiB
HTTP
96 lines
2.4 KiB
HTTP
###
|
|
POST http://localhost:8010/recipes
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "Ham and cheese toasties",
|
|
"ingredients": [
|
|
{
|
|
"name": "bread"
|
|
},{
|
|
"name": "ham"
|
|
},{
|
|
"name": "cheese"
|
|
}
|
|
]
|
|
}
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
});
|
|
%}
|
|
|
|
###
|
|
GET http://localhost:8010/recipes
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
client.assert(response.body === "{\"ham-and-cheese-toasties\":{\"name\":\"Ham and cheese toasties\",\"ingredients\":[{\"name\":\"bread\"},{\"name\":\"ham\"},{\"name\":\"cheese\"}]}}", "Body match expected response")
|
|
});
|
|
%}
|
|
|
|
###
|
|
GET http://localhost:8010/recipes/ham-and-cheese-toasties
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
client.assert(response.body === "{\"name\":\"Ham and cheese toasties\",\"ingredients\":[{\"name\":\"bread\"},{\"name\":\"ham\"},{\"name\":\"cheese\"}]}", "Body match expected response")
|
|
});
|
|
%}
|
|
|
|
###
|
|
PUT http://localhost:8010/recipes/ham-and-cheese-toasties
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "Ham and cheese toasties",
|
|
"ingredients": [
|
|
{
|
|
"name": "bread"
|
|
},{
|
|
"name": "ham"
|
|
},{
|
|
"name": "cheese"
|
|
},{
|
|
"name": "butter"
|
|
}
|
|
]
|
|
}
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
});
|
|
%}
|
|
|
|
###
|
|
GET http://localhost:8010/recipes/ham-and-cheese-toasties
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
client.assert(response.body === "{\"name\":\"Ham and cheese toasties\",\"ingredients\":[{\"name\":\"bread\"},{\"name\":\"ham\"},{\"name\":\"cheese\"},{\"name\":\"butter\"}]}", "Body match expected response")
|
|
|
|
});
|
|
%}
|
|
|
|
###
|
|
DELETE http://localhost:8010/recipes/ham-and-cheese-toasties
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 200, "Response status is not 200");
|
|
});
|
|
%}
|
|
|
|
###
|
|
GET http://localhost:8010/recipes/ham-and-cheese-toasties
|
|
|
|
> {%
|
|
client.test("Request executed successfully", function() {
|
|
client.assert(response.status === 404, "Response status is not 404");
|
|
});
|
|
%} |