| 9 | | my $c = HTTP::Engine::Compat::Context->new( |
| 10 | | req => HTTP::Engine::Request->new( |
| 11 | | _connection => { |
| 12 | | input_handle => \*STDIN, |
| 13 | | output_handle => \*STDIN, |
| 14 | | env => \%ENV, |
| 15 | | }, |
| 16 | | request_builder => HTTP::Engine::RequestBuilder->new, |
| 17 | | ) |
| 18 | | ); |
| 19 | | $c->req->method('POST'); |
| 20 | | $c->req->base(URI->new('http://d.hatena.ne.jp/')); |
| 21 | | $c->res->redirect('/TKSK/'); |
| 22 | | HTTP::Engine::ResponseFinalizer->finalize($c->req, $c->res); |
| 23 | | is $c->res->header('Location'), 'http://d.hatena.ne.jp/TKSK/'; |
| 24 | | is $c->res->status, 302; |
| 25 | | is $c->res->redirect, '/TKSK/'; |
| 26 | | is $c->res->body, '302: Redirect'; |
| | 9 | my $res = run_engine { |
| | 10 | my $c = shift; |
| | 11 | $c->res->redirect('/TKSK/'); |
| | 12 | } HTTP::Request->new('POST', 'http://d.hatena.ne.jp/'); |
| | 13 | is $res->header('Location'), 'http://d.hatena.ne.jp/TKSK/'; |
| | 14 | is $res->status, 302; |
| | 15 | is $res->redirect, '/TKSK/'; |
| | 16 | is $res->body, '302: Redirect'; |
| 30 | | my $c = HTTP::Engine::Compat::Context->new( |
| 31 | | req => HTTP::Engine::Request->new( |
| 32 | | _connection => { |
| 33 | | input_handle => \*STDIN, |
| 34 | | output_handle => \*STDIN, |
| 35 | | env => \%ENV, |
| 36 | | }, |
| 37 | | request_builder => HTTP::Engine::RequestBuilder->new, |
| 38 | | ) |
| 39 | | ); |
| 40 | | $c->req->method('GET'); |
| 41 | | $c->req->base(URI->new('http://d.hatena.ne.jp/')); |
| 42 | | $c->res->body('OK'); |
| 43 | | $c->res->redirect('/TKSK/' => 303); |
| 44 | | HTTP::Engine::ResponseFinalizer->finalize($c->req, $c->res); |
| 45 | | is $c->res->header('Location'), 'http://d.hatena.ne.jp/TKSK/'; |
| 46 | | is $c->res->status, 303; |
| 47 | | is $c->res->redirect, '/TKSK/'; |
| 48 | | is $c->res->body, 'OK'; |
| | 20 | my $res = run_engine { |
| | 21 | my $c = shift; |
| | 22 | $c->res->body('OK'); |
| | 23 | $c->res->redirect('/TKSK/' => 303); |
| | 24 | } HTTP::Request->new('GET', 'http://d.hatena.ne.jp'); |
| | 25 | is $res->header('Location'), 'http://d.hatena.ne.jp/TKSK/'; |
| | 26 | is $res->status, 303; |
| | 27 | is $res->redirect, '/TKSK/'; |
| | 28 | is $res->body, 'OK'; |