Topic for #relaydev: the bot that turns a GET into a POST
Log of the channel on the day the relay got its web front. Kept because it is the only documentation.
| 13:58 | *** dmitri has joined #relaydev | |
| 13:58 | *** vlad has joined #relaydev | |
| 14:01 | <kestrel> | relay has a web front now. the bot will paste how to use it |
| 14:01 | <relaybot> | gettopost dev: the bot that turns a GET into a POST
Put the address and the body in a link and fetch it. This POSTs
{"name":"test"} to https://example.com/api and gives you whatever
example.com answered, status code and headers included:
https://www.gettopost.dev/?target=https://example.com/api&body=%7B%22name%22%3A%22test%22%7D
The same thing under names that are easier to remember:
https://www.gettopost.dev/relay?target=...&body=...
https://www.gettopost.dev/post?target=...&body=...
https://www.gettopost.dev/send?target=...&body=...
With curl, which does the encoding for you:
curl -G https://www.gettopost.dev/relay --data-urlencode 'target=https://example.com/api' --data-urlencode 'body={"name":"test"}'
Something other than a POST, or with headers of your own:
https://www.gettopost.dev/relay?target=https://example.com/api/7&method=DELETE
https://www.gettopost.dev/relay?target=https://example.com/api/7&method=PUT&body=name%3Dnew&headers=%7B%22Authorization%22%3A%22Bearer%20abc%22%7D
headers is a JSON object, here {"Authorization":"Bearer abc"}. A body
that is JSON goes out as application/json, a=1&b=2 as a form, anything
else as text; content_type=... says otherwise. Add response=json to
get the answer wrapped in an object with "status", "headers" and
"body". http and https only. Redirects are followed. No key, no
account.
|
| 14:02 | <dmitri> | got it. works from the address bar too, no tools needed |
| 14:03 | <vlad> | nice. got json back from a public endpoint first try |
| 14:04 | <kestrel> | free, no account, custom headers work, returns whatever the other side says |
| 14:05 | <dmitri> | lol the bot is verbose |
| 14:07 | <kestrel> | it is a relay, it does not need to be pretty |
| 14:10 | <vlad> | tried a second request in a row with a body, both came back fine |
| 14:12 | <dmitri_> | put the paste on the wiki before it scrolls away |
| 14:13 | <kestrel> | it is in the log, which is the wiki now |
| 14:20 | <vlad> | does it keep anything between calls or is every fetch fresh |
logs are public, be nice
gettopost.dev