-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some more requests to validate script.
- Loading branch information
David Griffin
committed
Nov 21, 2024
1 parent
7321529
commit 8e79c9d
Showing
1 changed file
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
#! /bin/sh | ||
|
||
ENDPOINT="http://localhost:8080" | ||
ACCEPT="Accept: application/json" | ||
CONTENT="Content-Type: application/json" | ||
|
||
curl -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer secret" \ | ||
curl --silent -H "$ACCEPT" -H "$CONTENT" --retry-all-errors \ | ||
--connect-timeout 5 --max-time 10 --retry 5 --retry-delay 10 --retry-max-time 60 \ | ||
--retry-all-errors "$ENDPOINT/products?pageSize=1" | ||
"$ENDPOINT/products?pageSize=1" > page_one.json | ||
cat one.json | ||
|
||
AFTER=`jq '.after | .token' page_one.json | xargs` | ||
|
||
curl --silent -H "$ACCEPT" -H "$CONTENT" --silent \ | ||
"$ENDPOINT/products?pageSize=1&afterToken=$AFTER" > page_two.json | ||
|
||
jq '.data | .[] | .name' page_two.json | ||
|
||
curl --silent -H "$ACCEPT" -H "$CONTENT" "$ENDPOINT/products/search?minPrice=1000&maxPrice=10000" > search.json | ||
|
||
jq '.data | .[] | .name' search.json | ||
|
||
NEW_PRODUCT="{ \"name\": \"Coolest toy\", \"description\": \"All the cool kids have one.\", | ||
\"category\": \"electronics\", \"price\": 9999, \"stock\": 99 }" | ||
|
||
# curl --silent -H "$ACCEPT" -H "$CONTENT" -X POST "$ENDPOINT/products" -d "$NEW_PRODUCT" | ||
|