1Dancer2::Core::HTTP(3)User Contributed Perl DocumentationDancer2::Core::HTTP(3)
2
3
4
6 Dancer2::Core::HTTP - helper for rendering HTTP status codes for
7 Dancer2
8
10 version 0.400000
11
13 status(status_code)
14 Dancer2::Core::HTTP->status(200); # returns 200
15
16 Dancer2::Core::HTTP->status('Not Found'); # returns 404
17
18 Dancer2::Core::HTTP->status('bad_request'); # 400
19
20 Returns a HTTP status code. If given an integer, it will return the
21 value it received, else it will try to find the appropriate alias and
22 return the correct status.
23
24 status_message(status_code)
25 Dancer2::Core::HTTP->status_message(200); # returns 'OK'
26
27 Dancer2::Core::HTTP->status_message('error'); # returns 'Internal Server Error'
28
29 Returns the HTTP status message for the given status code.
30
31 status_mapping()
32 my %table = Dancer2::Core::HTTP->status_mapping;
33 # returns ( 'Ok' => 200, 'Created' => 201, ... )
34
35 Returns the full table of status -> code mappings.
36
37 code_mapping()
38 my %table = Dancer2::Core::HTTP->code_mapping;
39 # returns ( 200 => 'Ok', 201 => 'Created', ... )
40
41 Returns the full table of code -> status mappings.
42
43 all_mappings()
44 my %table = Dancer2::Core::HTTP->all_mappings;
45 # returns ( 418 => 'I'm a teapot', "I'm a teapot' => 418, 'i_m_a_teapot' => 418 )
46
47 Returns the code-to-status, status-to-code and underscore-groomed
48 status-to-code mappings all mashed up in a single table. Mostly for
49 internal uses.
50
52 Dancer Core Developers
53
55 This software is copyright (c) 2022 by Alexis Sukrieh.
56
57 This is free software; you can redistribute it and/or modify it under
58 the same terms as the Perl 5 programming language system itself.
59
60
61
62perl v5.36.0 2022-07-22 Dancer2::Core::HTTP(3)