summaryrefslogtreecommitdiff
path: root/yarns.webapp/yarn.sh
diff options
context:
space:
mode:
Diffstat (limited to 'yarns.webapp/yarn.sh')
-rw-r--r--yarns.webapp/yarn.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/yarns.webapp/yarn.sh b/yarns.webapp/yarn.sh
index 6f93a5f..f3f7bc2 100644
--- a/yarns.webapp/yarn.sh
+++ b/yarns.webapp/yarn.sh
@@ -96,3 +96,27 @@ start_webapp()
# listening on its assigned port.
"$SRCDIR/test-wait-for-port" 127.0.0.1 "$port"
}
+
+
+# Make a POST request.
+
+post_request()
+{
+ > "$DATADIR/response.headers"
+ > "$DATADIR/response.body"
+ port=$(cat "$DATADIR/webapp.port")
+
+ # The timestamp is needed by "THEN static status page got updated"
+ touch "$DATADIR/request.timestamp"
+
+ curl \
+ -D "$DATADIR/response.headers" \
+ -o "$DATADIR/response.body" \
+ --silent --show-error \
+ --request POST \
+ --data "$2" \
+ "http://127.0.0.1:$port$1"
+ cat "$DATADIR/response.headers"
+ cat "$DATADIR/response.body"
+ head -n1 "$DATADIR/response.headers" | grep '^HTTP/1\.[01] 200 '
+}