Skip to content

forward()ed POST request loses body? #1233

@bigpresh

Description

@bigpresh

Running this simple test case app, which outputs the request body, forward()s to another route and outputs the request body again:

#!/usr/bin/env perl

use 5.012;

use Dancer;
use DDP;

set serializer => 'JSON';


post '/foo' => sub {
    warn "foo running";
    p request->body;
    forward '/bar';
};

post '/bar' => sub {
    warn "Bar running";
    p request->body;
    return "Response from bar";
};

dance;

and hitting it with curl:

[davidp@supernova:~]$ curl http://localhost:3000/foo -H "Content-Type: application/json" -d '{"beer":true}'
Response from bar 

it outputs:

[davidp@supernova:~/tmp/dancer-forward-testcase]$ perl test.pl
>> Dancer 1.3513 server 367711 listening on http://0.0.0.0:3000
== Entering the development dance floor ...
foo running at test.pl line 12.
"{\"beer\":true}"
Bar running at test.pl line 18.
""

Reported by @fleetfootmike - thanks Mike!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions