7 use Catalyst::Test 'MyApp1';
8 use HTTP::Request::Common qw( GET PUT POST DELETE );
11 request( GET '/foo', ( Accept => 'application/json' ) );
14 $MyApp1::Controller::C1::REQ{get}, 1,
15 'GET request for /foo went to the right sub'
18 request( GET '/foo', ( Accept => '*/*', ) );
21 $MyApp1::Controller::C1::REQ{get_html}, 1,
22 'GET request for /foo that looks like a browser went to the right sub'
25 request( POST '/foo' );
28 $MyApp1::Controller::C1::REQ{post}, 1,
29 'POST request for /foo went to the right sub'
32 request( PUT '/foo' );
35 $MyApp1::Controller::C1::REQ{put}, 1,
36 'PUT request for /foo went to the right sub'
39 request( DELETE '/foo' );
42 $MyApp1::Controller::C1::REQ{delete}, 1,
43 'DELETE request for /foo went to the right sub'
48 request( GET '/c1/bar', ( Accept => 'application/json' ) );
51 $MyApp1::Controller::C1::REQ{get}, 2,
52 'GET request for /c1/bar went to the right sub'
55 request( GET '/c1/bar', ( Accept => '*/*', ) );
58 $MyApp1::Controller::C1::REQ{get_html}, 2,
59 'GET request for /c1/bar that looks like a browser went to the right sub'
62 request( POST '/c1/bar' );
65 $MyApp1::Controller::C1::REQ{post}, 2,
66 'POST request for /c1/bar went to the right sub'
69 request( PUT '/c1/bar' );
72 $MyApp1::Controller::C1::REQ{put}, 2,
73 'PUT request for /c1/bar went to the right sub'
76 request( DELETE '/c1/bar' );
79 $MyApp1::Controller::C1::REQ{delete}, 2,
80 'DELETE request for /c1/bar went to the right sub'
85 get('/chain1/42/chain2/84/baz/foo');
88 $MyApp1::Controller::C1::REQ{chain1}, 42,
89 'chain1 chain point captured the first arg'
93 $MyApp1::Controller::C1::REQ{chain2}, 84,
94 'chain2 chain point captured the second arg'
98 $MyApp1::Controller::C1::REQ{baz}, 'foo',
99 'baz route captured the third arg'
107 $MyApp1::Controller::C1::REQ{normal}, 1,
108 'GET request for /normal went to the right sub'
111 request( POST '/normal' );
114 $MyApp1::Controller::C1::REQ{normal}, 2,
115 'POST request for /normal went to the right sub'