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_redirectto handle redirects manually ortxfor transaction requests.postUrl(required): The URL to which the POST request should be proxied.
-
Body: JSON payload conforming to the
FrameActionPayloadstructure 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
locationheader value from the response, with a status code of 302.
- Returns a JSON object containing the
-
For
postTypeoftx:- 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 thegetFramefunction 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
postUrlparameter in the request. - Any fetch operation or processing errors.
- Absence of the
