Reroute with POST method

52 views
Skip to first unread message

Gosforth

unread,
Jul 1, 2019, 4:49:46 AM7/1/19
to Fat-Free Framework
How to reroute with POST?

With GET we have:

$f3->reroute('/search/?email=p...@p.com');

How to send this URL in post (with email value)?

Regards

Rayne

unread,
Jul 1, 2019, 1:20:53 PM7/1/19
to Fat-Free Framework
It is not possible to send POST when redirecting (which leads to a GET request).


Am Montag, 1. Juli 2019 10:49:46 UTC+2 schrieb Gosforth:
How to reroute with POST?

With GET we have:

$f3->reroute('/search/?email=p@p.com');

Paul Herring

unread,
Jul 2, 2019, 3:58:13 AM7/2/19
to Fat-Free Framework
On Mon, Jul 1, 2019 at 6:20 PM Rayne via Fat-Free Framework <f3-framework+APn2wQfNn1ljZx22rPO...@googlegroups.com> wrote:
It is not possible to send POST when redirecting

Yes it is, 

(which leads to a GET request).

and no it doesn't.


The method and the body of the original request are reused to perform the redirected request. In the cases where you want the method used to be changed to GET, use 303 See Other instead. This is useful when you want to give an answer to a PUT method that is not the uploaded resources, but a confirmation message (like "You successfully uploaded XYZ").

The only difference between 307 and 302 is that 307 guarantees that the method and the body will not be changed when the redirected request is made.

 
I thought I'd looked into doing this with F3 previously, but can't seem to find any code that I've actually written to do it...


Am Montag, 1. Juli 2019 10:49:46 UTC+2 schrieb Gosforth:
How to reroute with POST?

With GET we have:

$f3->reroute('/search/?email=p...@p.com');

How to send this URL in post (with email value)?

Regards

--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/b6dd2bb0-4d7e-459b-bbe0-90d8a24d6069%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
PJH

xfra35

unread,
Jul 2, 2019, 5:08:05 AM7/2/19
to Fat-Free Framework
That's interesting.

AFAIK the framework doesn't support 307 redirects out of the box. But you should be able to set it up quite easily:

header('Location: /search/?email=p...@p.com');
$f3
->status(307);
die();

Rayne

unread,
Jul 3, 2019, 9:28:09 AM7/3/19
to Fat-Free Framework
That is great! Thanks for the correction.
Reply all
Reply to author
Forward
0 new messages