You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
Markdown
65 lines
1.6 KiB
Markdown
|
|
```
|
|
[build]
|
|
kill_delay = "1s"
|
|
send_interrupt = true
|
|
```
|
|
|
|
|
|
## Get Movie
|
|
|
|
```bash
|
|
curl -i http://0.0.0.0:5002/v1/movies/1
|
|
```
|
|
|
|
## Creating a movie
|
|
|
|
```bash
|
|
curl -i -X POST -d '{"title":"Moana","year":2016,"runtime":"107 mins", "genres":["animation","adventure"]}' http://0.0.0.0:5002/v1/movies
|
|
```
|
|
|
|
```bash
|
|
curl -i -X POST -d '{"title":"The Batman","year":2022,"runtime":"177 mins", "genres":["action","adventure"]}' http://0.0.0.0:5002/v1/movies
|
|
```
|
|
|
|
|
|
```bash
|
|
curl -i -X POST -d '{"title":"Death of a Unicorn","year":2025,"runtime":"126 mins", "genres":["comedy","satire"]}' http://0.0.0.0:5002/v1/movies
|
|
```
|
|
|
|
|
|
```bash
|
|
BODY='{"title":"Black Panther","year":2018,"runtime":"134 mins","genres":["sci-fi","action","adventure"]}'
|
|
curl -X PUT -d "$BODY" http://0.0.0.0:5002/v1/movies/1
|
|
```
|
|
|
|
## Generating an Update Conflict
|
|
|
|
We can try to use the xargs tool to submit multiple requests to our webserver. Hopefully this results in the 409 that we are looking to create.
|
|
|
|
```bash
|
|
xargs -I % -P8 curl -X PATCH -d '{"runtime": "97 mins"}' "localhost:5002/v1/movies/4" < <(printf '%s\n' {1..8})
|
|
```
|
|
|
|
## Adding Time Taken To You Curl Request
|
|
|
|
Use the `-w` to anotate the response `https://blog.josephscott.org/2011/10/14/timing-details-with-curl/`
|
|
|
|
```bash
|
|
curl -w '\nTime: %{time_total}s \n' localhost:5002/v1/movies/4
|
|
{
|
|
"movie": {
|
|
"id": 4,
|
|
"title": "The Batman",
|
|
"year": 2021,
|
|
"Runtime": "97 mins",
|
|
"genres": [
|
|
"action",
|
|
"adventure"
|
|
],
|
|
"version": 5
|
|
}
|
|
}
|
|
|
|
Time: 8.009385s
|
|
``` |