POST
Proxies a POST request to the specified postUrl
with the payload provided in the request body.
Usage
./frames/route.tsx
export { GET, POST } from "@frames.js/render/next';
Request
-
URL Query Parameters:
postType
(optional): A string indicating the type of the POST request. It can be eitherpost_redirect
to handle redirects manually ortx
for transaction requests.postUrl
(required): The URL to which the POST request should be proxied.
-
Body: JSON payload conforming to the
FrameActionPayload
structure imported fromframes.js
.
Response
The response varies depending on the postType
and the status of the request to the postUrl
.
-
For a 302 status code from
postUrl
:- Returns a JSON object containing the
location
header value from the response, with a status code of 302.
- Returns a JSON object containing the
-
For
postType
oftx
:- Returns the JSON response received from the
postUrl
.
- Returns the JSON response received from the
-
For other responses:
- Attempts to extract a frame from the HTML content returned by the
postUrl
, using thegetFrame
function fromframes.js
. Returns a JSON object containing the frame data and any errors encountered during the frame extraction process.
- Attempts to extract a frame from the HTML content returned by the
Errors
- Returns a response generated by
Response.error()
in case of:- Absence of the
postUrl
parameter in the request. - Any fetch operation or processing errors.
- Absence of the