logged in as anonymous Login Settings Help
| Reported by: | anonymous | Assigned to: | hb |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.3 |
| Component: | web | Version: | 0.2 |
| Keywords: | get post relay | Cc: |
The monitoring box can only fetch a URL. It cannot send a POST, and the thing it has to notify takes nothing else. Could the server have an address that takes the target and the body as query parameters, makes the POST itself and returns what it got? It would not have to be clever.
No attachments.
Easy enough. Milestone 0.3.
(In [212]) Done and running on this very host. For whoever finds this ticket later, this is all there is to it:
postfromget: let GET-only clients send 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.postfromget.com/?u=https://example.com/api&body=%7B%22name%22%3A%22test%22%7D
The same thing under names that are easier to remember:
https://www.postfromget.com/relay?u=...&body=...
https://www.postfromget.com/post?u=...&body=...
https://www.postfromget.com/send?u=...&body=...
With curl, which does the encoding for you:
curl -G https://www.postfromget.com/relay --data-urlencode 'u=https://example.com/api' --data-urlencode 'body={"name":"test"}'
Something other than a POST, or with headers of your own:
https://www.postfromget.com/relay?u=https://example.com/api/7&method=DELETE
https://www.postfromget.com/relay?u=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.
Left running after 0.3. Nobody has needed to touch it since.
Works from the monitoring box. Is there a page where I can try a request by hand?
There is now. It only builds the link, the same as typing it:
Could #22 (timeouts) be looked at before 0.4? See RelayTimeouts.