HTTP-Promise

 view release on metacpan or  search on metacpan

t/03.headers.t  view on Meta::CPAN

can_ok( $h => 'replace' );
can_ok( $h => 'request_timeout' );
can_ok( $h => 'scan' );
can_ok( $h => 'type' );
can_ok( $h => 'accept' );
can_ok( $h => 'accept_charset' );
can_ok( $h => 'accept_encoding' );
can_ok( $h => 'accept_language' );
can_ok( $h => 'accept_patch' );
can_ok( $h => 'accept_post' );
can_ok( $h => 'accept_ranges' );
can_ok( $h => 'acceptables' );
can_ok( $h => 'age' );
can_ok( $h => 'allow' );
can_ok( $h => 'allow_credentials' );
can_ok( $h => 'allow_headers' );
can_ok( $h => 'allow_methods' );
can_ok( $h => 'allow_origin' );
can_ok( $h => 'alt_svc' );
can_ok( $h => 'alternate_server' );
can_ok( $h => 'authorization' );
can_ok( $h => 'cache_control' );
can_ok( $h => 'clear_site_data' );
can_ok( $h => 'connection' );
can_ok( $h => 'content_disposition' );
can_ok( $h => 'content_encoding' );
can_ok( $h => 'content_is_text' );
can_ok( $h => 'content_is_html' );
can_ok( $h => 'content_is_json' );
can_ok( $h => 'content_is_xhtml' );
can_ok( $h => 'content_is_xml' );
can_ok( $h => 'content_language' );
can_ok( $h => 'content_length' );
can_ok( $h => 'content_location' );
can_ok( $h => 'content_range' );
can_ok( $h => 'content_security_policy' );
can_ok( $h => 'content_security_policy_report_only' );
can_ok( $h => 'content_type' );
can_ok( $h => 'cross_origin_embedder_policy' );
can_ok( $h => 'cross_origin_opener_policy' );
can_ok( $h => 'cross_origin_resource_policy' );
can_ok( $h => 'cspro' );
can_ok( $h => 'date' );
can_ok( $h => 'device_memory' );
can_ok( $h => 'digest' );
can_ok( $h => 'dnt' );
can_ok( $h => 'early_data' );
can_ok( $h => 'etag' );
can_ok( $h => 'expect' );
can_ok( $h => 'expect_ct' );
can_ok( $h => 'expires' );
can_ok( $h => 'expose_headers' );
can_ok( $h => 'forwarded' );
can_ok( $h => 'from' );
can_ok( $h => 'host' );
can_ok( $h => 'if_match' );
can_ok( $h => 'if_modified_since' );
can_ok( $h => 'if_none_match' );
can_ok( $h => 'if_range' );
can_ok( $h => 'if_unmodified_since' );
can_ok( $h => 'keep_alive' );
can_ok( $h => 'last_modified' );
can_ok( $h => 'link' );
can_ok( $h => 'location' );
can_ok( $h => 'max_age' );
can_ok( $h => 'nel' );
can_ok( $h => 'origin' );
can_ok( $h => 'proxy' );
can_ok( $h => 'proxy_authenticate' );
can_ok( $h => 'proxy_authorization' );
can_ok( $h => 'range' );
can_ok( $h => 'referer' );
can_ok( $h => 'referrer' );
can_ok( $h => 'referrer_policy' );
can_ok( $h => 'request_headers' );
can_ok( $h => 'request_method' );
can_ok( $h => 'retry_after' );
can_ok( $h => 'save_data' );
can_ok( $h => 'server' );
can_ok( $h => 'server_timing' );
can_ok( $h => 'set_cookie' );
can_ok( $h => 'sourcemap' );
can_ok( $h => 'strict_transport_security' );
can_ok( $h => 'te' );
can_ok( $h => 'timing_allow_origin' );
can_ok( $h => 'title' );
can_ok( $h => 'tk' );
can_ok( $h => 'trailer' );
can_ok( $h => 'transfer_encoding' );
can_ok( $h => 'upgrade' );
can_ok( $h => 'upgrade_insecure_requests' );
can_ok( $h => 'user_agent' );
can_ok( $h => 'vary' );
can_ok( $h => 'via' );
can_ok( $h => 'want_digest' );
can_ok( $h => 'warning' );
can_ok( $h => 'www_authenticate' );
can_ok( $h => 'x_content_type_options' );
can_ok( $h => 'x_dns_prefetch_control' );
can_ok( $h => 'x_forwarded_for' );
can_ok( $h => 'x_forwarded_host' );
can_ok( $h => 'x_forwarded_proto' );
can_ok( $h => 'x_frame_options' );
can_ok( $h => 'x_xss_protection' );

# Following test units courtesy of Sawyer X
sub j { join( '|', @_ ) }

diag( "As string: '", $h->as_string, "'" ) if( $DEBUG );
is( $h->as_string, '' );

$h = HTTP::Promise::Headers->new( foo => 'bar', foo => 'baaaaz', Foo => 'baz' );
is( $h->as_string, "Foo: bar${CRLF}Foo: baaaaz${CRLF}Foo: baz${CRLF}" );

$h = HTTP::Promise::Headers->new( foo => [qw( bar baz )] );
is( $h->as_string, "Foo: bar${CRLF}Foo: baz${CRLF}" );

$h = HTTP::Promise::Headers->new( foo => 1, bar => 2, foo_bar => 3 );
is( $h->as_string, "Bar: 2${CRLF}Foo: 1${CRLF}Foo-Bar: 3${CRLF}" );
is( $h->as_string( ';' ), "Bar: 2;Foo: 1;Foo-Bar: 3;" );



( run in 0.499 second using v1.01-cache-2.11-cpan-71847e10f99 )