swaggerblueprint

Blueprint project
git clone git://git.wimdupont.com/swaggerblueprint.git
Log | Files | Refs | README | LICENSE

commit 6626e82d1106f72e98e0dabbff2a31fd1c5eab6e
parent 206240d936b15c67462df6adf979eb26ee33196b
Author: Wim Dupont <wim@wimdupont.com>
Date:   Mon,  6 Feb 2023 23:32:21 +0100

added play script

Diffstat:
Asrc/test/resources/play.sh | 44++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/test/resources/play.sh b/src/test/resources/play.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +method=$1 +id=$2 +base_url="http://localhost:8080/blueprints" + +if [ -z "${method}" ]; then + echo "Request method? (GET/POST/PUT/DELETE)" + read -r method +fi + +get_id () { + if [ -z "${id}" ]; then + echo "For what UUID?" + read -r id + fi +} + +case ${method^^} in + + GET) + curl -X GET -sw '%{http_code}' "${base_url}" | jq + ;; + + POST) + curl -X POST -sw '%{http_code}' "${base_url}" -H 'Content-Type: application/json' -d '{"name":"Created John","number":120}' | jq + ;; + + PUT) + get_id + curl -X PUT -sw '%{http_code}' "${base_url}/${id}" -H 'Content-Type: application/json' -d '{"name":"Updated John","number":166}' | jq + ;; + + DELETE) + get_id + curl -k -X 'DELETE' -sw '%{http_code}' "${base_url}/${id}" | jq + ;; + + *) + echo "Unknown http method." + ;; +esac + +