1Catalyst::ActionRole::SUcsheermeC(o3n)tributed Perl DocuCmaetnatlaytsito:n:ActionRole::Scheme(3)
2
3
4
6 Catalyst::ActionRole::Scheme - Match on HTTP Request Scheme
7
9 package MyApp::Web::Controller::MyController;
10
11 use base 'Catalyst::Controller';
12
13 sub is_http :Path(scheme) Scheme(http) Args(0) {
14 my ($self, $c) = @_;
15 Test::More::is $c->action->scheme, 'http';
16 $c->response->body("is_http");
17 }
18
19 sub is_https :Path(scheme) Scheme(https) Args(0) {
20 my ($self, $c) = @_;
21 Test::More::is $c->action->scheme, 'https';
22 $c->response->body("is_https");
23 }
24
25 1;
26
28 This is an action role that lets your Catalyst::Action match on the
29 scheme type of the request. Typically this is "http" or "https" but
30 other common schemes that Catalyst can handle include "ws" and "wss"
31 (web socket and web socket secure).
32
33 This also ensures that if you use "uri_for" on an action that specifies
34 a match scheme, that the generated URI object sets its scheme to that
35 automatically (rather than the scheme of the current request object,
36 which is and remains the default behavior.)
37
38 For matching purposes, we match strings but the casing is insensitive.
39
41 This role requires the following methods in the consuming class.
42
43 match
44 match_captures
45 Returns 1 if the action matches the existing request and zero if not.
46
48 This role defines the following methods
49
50 match
51 match_captures
52 Around method modifier that return 1 if the scheme matches
53
54 list_extra_info
55 Add the scheme declaration if present to the debug screen.
56
58 Catalyst Contributors, see Catalyst
59
61 See Catalyst
62
63
64
65perl v5.36.0 2023-01-20 Catalyst::ActionRole::Scheme(3)