line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::HTTPStatus; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1188
|
use Mojo::Base 'Exporter'; |
|
1
|
|
|
|
|
151796
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
574
|
use Package::Constants; |
|
1
|
|
|
|
|
1645
|
|
|
1
|
|
|
|
|
93
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
|
|
|
|
|
|
# --- 1×× Informational |
9
|
1
|
|
|
|
|
431
|
CONTINUE => 100, |
10
|
|
|
|
|
|
|
SWITCHING_PROTOCOLS => 101, |
11
|
|
|
|
|
|
|
PROCESSING => 102, |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# --- 2×× Success |
14
|
|
|
|
|
|
|
OK => 200, |
15
|
|
|
|
|
|
|
CREATED => 201, |
16
|
|
|
|
|
|
|
ACCEPTED => 202, |
17
|
|
|
|
|
|
|
NON_AUTHORITATIVE_INFORMATION => 203, |
18
|
|
|
|
|
|
|
NO_CONTENT => 204, |
19
|
|
|
|
|
|
|
RESET_CONTENT => 205, |
20
|
|
|
|
|
|
|
PARTIAL_CONTENT => 206, |
21
|
|
|
|
|
|
|
MULTI_STATUS => 207, |
22
|
|
|
|
|
|
|
ALREADY_REPORTED => 208, |
23
|
|
|
|
|
|
|
IM_USED => 226, |
24
|
|
|
|
|
|
|
MULTIPLE_CHOICES => 300, |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# -- 3×× Redirection |
27
|
|
|
|
|
|
|
MOVED_PERMANENTLY => 301, |
28
|
|
|
|
|
|
|
FOUND => 302, |
29
|
|
|
|
|
|
|
SEE_OTHER => 303, |
30
|
|
|
|
|
|
|
NOT_MODIFIED => 304, |
31
|
|
|
|
|
|
|
USE_PROXY => 305, |
32
|
|
|
|
|
|
|
TEMPORARY_REDIRECT => 307, |
33
|
|
|
|
|
|
|
PERMANENT_REDIRECT => 308, |
34
|
|
|
|
|
|
|
BAD_REQUEST => 400, |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# ---4×× Client Error |
37
|
|
|
|
|
|
|
UNAUTHORIZED => 401, |
38
|
|
|
|
|
|
|
PAYMENT_REQUIRED => 402, |
39
|
|
|
|
|
|
|
FORBIDDEN => 403, |
40
|
|
|
|
|
|
|
NOT_FOUND => 404, |
41
|
|
|
|
|
|
|
METHOD_NOT_ALLOWED => 405, |
42
|
|
|
|
|
|
|
NOT_ACCEPTABLE => 406, |
43
|
|
|
|
|
|
|
PROXY_AUTHENTICATION_REQUIRED => 407, |
44
|
|
|
|
|
|
|
REQUEST_TIMEOUT => 408, |
45
|
|
|
|
|
|
|
CONFLICT => 409, |
46
|
|
|
|
|
|
|
GONE => 410, |
47
|
|
|
|
|
|
|
LENGTH_REQUIRED => 411, |
48
|
|
|
|
|
|
|
PRECONDITION_FAILED => 412, |
49
|
|
|
|
|
|
|
PAYLOAD_TOO_LARGE => 413, |
50
|
|
|
|
|
|
|
REQUEST_URI_TOO_LONG => 414, |
51
|
|
|
|
|
|
|
UNSUPPORTED_MEDIA_TYPE => 415, |
52
|
|
|
|
|
|
|
REQUESTED_RANGE_NOT_SATISFIABLE => 416, |
53
|
|
|
|
|
|
|
EXPECTATION_FAILED => 417, |
54
|
|
|
|
|
|
|
I_M_A_TEAPOT => 418, |
55
|
|
|
|
|
|
|
MISDIRECTED_REQUEST => 421, |
56
|
|
|
|
|
|
|
UNPROCESSABLE_ENTITY => 422, |
57
|
|
|
|
|
|
|
LOCKED => 423, |
58
|
|
|
|
|
|
|
FAILED_DEPENDENCY => 424, |
59
|
|
|
|
|
|
|
UPGRADE_REQUIRED => 426, |
60
|
|
|
|
|
|
|
PRECONDITION_REQUIRED => 428, |
61
|
|
|
|
|
|
|
TOO_MANY_REQUESTS => 429, |
62
|
|
|
|
|
|
|
REQUEST_HEADER_FIELDS_TOO_LARGE => 431, |
63
|
|
|
|
|
|
|
CONNECTION_CLOSED_WITHOUT_RESPONSE => 444, |
64
|
|
|
|
|
|
|
UNAVAILABLE_FOR_LEGAL_REASONS => 451, |
65
|
|
|
|
|
|
|
CLIENT_CLOSED_REQUEST => 499, |
66
|
|
|
|
|
|
|
INTERNAL_SERVER_ERROR => 500, |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# -- 5×× Server Error |
69
|
|
|
|
|
|
|
NOT_IMPLEMENTED => 501, |
70
|
|
|
|
|
|
|
BAD_GATEWAY => 502, |
71
|
|
|
|
|
|
|
SERVICE_UNAVAILABLE => 503, |
72
|
|
|
|
|
|
|
GATEWAY_TIMEOUT => 504, |
73
|
|
|
|
|
|
|
HTTP_VERSION_NOT_SUPPORTED => 505, |
74
|
|
|
|
|
|
|
VARIANT_ALSO_NEGOTIATES => 506, |
75
|
|
|
|
|
|
|
INSUFFICIENT_STORAGE => 507, |
76
|
|
|
|
|
|
|
LOOP_DETECTED => 508, |
77
|
|
|
|
|
|
|
NOT_EXTENDED => 510, |
78
|
|
|
|
|
|
|
NETWORK_AUTHENTICATION_REQUIRED => 511, |
79
|
|
|
|
|
|
|
NETWORK_CONNECT_TIMEOUT_ERROR => 599, |
80
|
1
|
|
|
1
|
|
6
|
}; |
|
1
|
|
|
|
|
1
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
our @EXPORT_OK = ( Package::Constants->list(__PACKAGE__) ); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
our $VERSION = '0.0.2'; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=encoding utf8 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Mojo::HTTPStatus - Readable HTTP status codes |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
use Mojo::HTTPStatus qw(CREATED I_M_A_TEAPOT); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub create { |
99
|
|
|
|
|
|
|
my $self = shift(); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $body = ...; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
return $self->render(json => $body, status => CREATED); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub another_action { |
107
|
|
|
|
|
|
|
my $self = shift(); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
... |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
return $self->render(text => 'Ooops' status => I_M_A_TEAPOT); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DESCRPTION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The module exports a list of readable constants for HTTP status code. For more descriptions of the codes please visit L |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 CONSTANTS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 1×× Informational |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
CONTINUE 100 |
123
|
|
|
|
|
|
|
SWITCHING_PROTOCOLS 101 |
124
|
|
|
|
|
|
|
PROCESSING 102 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head3 2×× Success |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
OK 200 |
129
|
|
|
|
|
|
|
CREATED 201 |
130
|
|
|
|
|
|
|
ACCEPTED 202 |
131
|
|
|
|
|
|
|
NON_AUTHORITATIVE_INFORMATION 203 |
132
|
|
|
|
|
|
|
NO_CONTENT 204 |
133
|
|
|
|
|
|
|
RESET_CONTENT 205 |
134
|
|
|
|
|
|
|
PARTIAL_CONTENT 206 |
135
|
|
|
|
|
|
|
MULTI_STATUS 207 |
136
|
|
|
|
|
|
|
ALREADY_REPORTED 208 |
137
|
|
|
|
|
|
|
IM_USED 226 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head3 3×× Redirection |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
MULTIPLE_CHOICES 300 |
142
|
|
|
|
|
|
|
MOVED_PERMANENTLY 301 |
143
|
|
|
|
|
|
|
FOUND 302 |
144
|
|
|
|
|
|
|
SEE_OTHER 303 |
145
|
|
|
|
|
|
|
NOT_MODIFIED 304 |
146
|
|
|
|
|
|
|
USE_PROXY 305 |
147
|
|
|
|
|
|
|
TEMPORARY_REDIRECT 307 |
148
|
|
|
|
|
|
|
PERMANENT_REDIRECT 308 |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head3 4×× Client Error |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
BAD_REQUEST 400 |
153
|
|
|
|
|
|
|
UNAUTHORIZED 401 |
154
|
|
|
|
|
|
|
PAYMENT_REQUIRED 402 |
155
|
|
|
|
|
|
|
FORBIDDEN 403 |
156
|
|
|
|
|
|
|
NOT_FOUND 404 |
157
|
|
|
|
|
|
|
METHOD_NOT_ALLOWED 405 |
158
|
|
|
|
|
|
|
NOT_ACCEPTABLE 406 |
159
|
|
|
|
|
|
|
PROXY_AUTHENTICATION_REQUIRED 407 |
160
|
|
|
|
|
|
|
REQUEST_TIMEOUT 408 |
161
|
|
|
|
|
|
|
CONFLICT 409 |
162
|
|
|
|
|
|
|
GONE 410 |
163
|
|
|
|
|
|
|
LENGTH_REQUIRED 411 |
164
|
|
|
|
|
|
|
PRECONDITION_FAILED 412 |
165
|
|
|
|
|
|
|
PAYLOAD_TOO_LARGE 413 |
166
|
|
|
|
|
|
|
REQUEST_URI_TOO_LONG 414 |
167
|
|
|
|
|
|
|
UNSUPPORTED_MEDIA_TYPE 415 |
168
|
|
|
|
|
|
|
REQUESTED_RANGE_NOT_SATISFIABLE 416 |
169
|
|
|
|
|
|
|
EXPECTATION_FAILED 417 |
170
|
|
|
|
|
|
|
I_M_A_TEAPOT 418 |
171
|
|
|
|
|
|
|
MISDIRECTED_REQUEST 421 |
172
|
|
|
|
|
|
|
UNPROCESSABLE_ENTITY 422 |
173
|
|
|
|
|
|
|
LOCKED 423 |
174
|
|
|
|
|
|
|
FAILED_DEPENDENCY 424 |
175
|
|
|
|
|
|
|
UPGRADE_REQUIRED 426 |
176
|
|
|
|
|
|
|
PRECONDITION_REQUIRED 428 |
177
|
|
|
|
|
|
|
TOO_MANY_REQUESTS 429 |
178
|
|
|
|
|
|
|
REQUEST_HEADER_FIELDS_TOO_LARGE 431 |
179
|
|
|
|
|
|
|
CONNECTION_CLOSED_WITHOUT_RESPONSE 444 |
180
|
|
|
|
|
|
|
UNAVAILABLE_FOR_LEGAL_REASONS 451 |
181
|
|
|
|
|
|
|
CLIENT_CLOSED_REQUEST 499 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head3 5×× Server Error |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
INTERNAL_SERVER_ERROR 500 |
186
|
|
|
|
|
|
|
NOT_IMPLEMENTED 501 |
187
|
|
|
|
|
|
|
BAD_GATEWAY 502 |
188
|
|
|
|
|
|
|
SERVICE_UNAVAILABLE 503 |
189
|
|
|
|
|
|
|
GATEWAY_TIMEOUT 504 |
190
|
|
|
|
|
|
|
HTTP_VERSION_NOT_SUPPORTED 505 |
191
|
|
|
|
|
|
|
VARIANT_ALSO_NEGOTIATES 506 |
192
|
|
|
|
|
|
|
INSUFFICIENT_STORAGE 507 |
193
|
|
|
|
|
|
|
LOOP_DETECTED 508 |
194
|
|
|
|
|
|
|
NOT_EXTENDED 510 |
195
|
|
|
|
|
|
|
NETWORK_AUTHENTICATION_REQUIRED 511 |
196
|
|
|
|
|
|
|
NETWORK_CONNECT_TIMEOUT_ERROR 599 |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 AUTHOR |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Tudor Marghidanu L |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright (C) 2019, Tudor Marghidanu. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
__END__ |