#!/bin/bash

URL="$1"
if [ -z "$1" ]; then
	echo "Usage: $0 URL"
	exit 1
fi

curl -v -d "$URL" -H "Content-Type: text/plain" 127.0.0.1:1969/web | jq '{ url: .url, session: .session, items: .items | to_entries | [.[0]] | from_entries }' | curl -v -d @- -H "Content-Type: application/json" 127.0.0.1:1969/web
