Help language development. Donate to The Perl Foundation

HTTP::Status zef:lizmat last updated on 2022-05-28

use HTTP::Status;
use Test;

plan 14;

is get_http_status_msg(200), 'OK',        'Known code 1';
is get_http_status_msg(404), 'Not Found', 'Known code 2';
is get_http_status_msg(289), 'Unknown',   'Unknown code 1';
is get_http_status_msg(607), 'Unknown',   'Unknown code 2';

is HTTP::Status(100),        'Continue',      'is 100 text ok';
is HTTP::Status(100).code,    100,            'is 100 code ok';
is HTTP::Status(100).type,   'Informational', 'is 100 type ok';
ok HTTP::Status(100).summary.chars,           'is 100 summary ok';
is HTTP::Status(100).origin, 'IANA',          'is 100 origin ok';
is HTTP::Status(100).since,  'HTTP/1.0',      'is 100 since ok';
is HTTP::Status(100).RFC,     7231,           'is 100 RFC ok';

is-deeply HTTP::Status(137), Nil, 'does status 137 not exist';
  code    => 137,
  title   => "Very Special Prime",
  summary => "Really the answer!",
  origin  => "Mathematics",
  since   => "HTTP/2.1",
  RFC     => 13377,

is HTTP::Status(137), 'Very Special Prime', 'did the object get made';

ok HTTP::Status.source.starts-with(''),
  'does the source look ok';

# vim: expandtab shiftwidth=4