-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
forward()ed POST request loses body? #1233
Comments
Ah, Dancer::Request->forward() doesn't copy the raw body over, but it does copy the deserialized params over, so dumping the deserialised value: #!/usr/bin/env perl
use 5.012;
use Dancer;
use DDP;
set serializer => 'JSON';
post '/foo' => sub {
warn "foo running";
p request->body;
p params->{beer}, as => 'beer in foo';
forward '/bar';
};
post '/bar' => sub {
warn "Bar running";
p request->body;
p params->{beer}, as => 'beer in bar';
return "Response from bar";
};
dance;
shows that
|
So, the impact looks limited - params will be retained etc, but the raw body may not be. @fleetfootmike points out that it also causes a spurious deserialisation error at loglevel
One possibly-reasonable solution to the spurious error would be for |
The lack of the body on a forwarded request is the real issue, though. OTTOMH, a simple fix should be to add ``$new_request->{_http_body} = $request->{_http_body} |
Running this simple test case app, which outputs the request body,
forward()
s to another route and outputs the request body again:and hitting it with curl:
it outputs:
Reported by @fleetfootmike - thanks Mike!
The text was updated successfully, but these errors were encountered: