logged in as anonymous Login Settings Help

← Previous Ticket   Next Ticket →

Ticket #14 (closed enhancement: fixed)

let GET-only clients send a POST

Reported by:anonymousAssigned to:hb
Priority:normalMilestone:0.3
Component:webVersion:0.2
Keywords:get post relayCc:

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.

Attachments

No attachments.

Change History

03/09/06 10:12:44 changed by hb

Easy enough. Milestone 0.3.

03/21/06 23:40:02 changed by hb

(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.

04/02/06 08:15:31 changed by anonymous

Works from the monitoring box. Is there a page where I can try a request by hand?

04/02/06 19:03:10 changed by hb

There is now. It only builds the link, the same as typing it:

Try a request




11/17/06 14:26:55 changed by anonymous

Could #22 (timeouts) be looked at before 0.4? See RelayTimeouts.