view release on metacpan or search on metacpan
t/tag-inline.t view on Meta::CPAN
template vimg => sub {
img(src => "/one.jpg");
};
template vmeta => sub {
meta(content => "text/html", "http-equiv" => "content-type");
};
template vhtml_link => sub {
html_link(rel=>'stylesheet', href=>'/style.css');
};
t/tag-inline.t view on Meta::CPAN
use Test::More tests => 6;
is(View->render("vhr"), qq{<hr>});
is(View->render("vbr"), qq{<br>});
is(View->render("vimg"), qq{<img src="/one.jpg">});
is(View->render("vmeta"), qq{<meta content="text/html" http-equiv="content-type">});
is(View->render("vhtml_link"), qq{<link rel="stylesheet" href="/style.css">});
is(View->render("vinput"), qq{<input type="text" name="foo">});
view all matches for this distribution
view release on metacpan or search on metacpan
t/order-parsing.t view on Meta::CPAN
],
'content-length' => '2177',
'p3p' => 'CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"',
'hamster' => '225',
'server' => 'nginx',
'content-type' => 'text/xml; charset=utf-8'
},
'success' => 1,
'content' => '<?xml version="1.0" encoding="utf-8"?>
<result>
<success>1</success>
t/order-parsing.t view on Meta::CPAN
],
'content-length' => '2177',
'p3p' => 'CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"',
'hamster' => '225',
'server' => 'nginx',
'content-type' => 'text/xml; charset=utf-8'
},
'success' => 1,
'content' => '<?xml version="1.0" encoding="utf-8"?>
<result>
<success>1</success>
view all matches for this distribution
view release on metacpan or search on metacpan
t/02headers.t view on Meta::CPAN
($test_result) = $output =~ m{Content-length: (.*?)[\r\n\f]}i;
is($test_result, '180', "content-length ok: [$test_result]");
($test_result) = $output =~ m{Content-Type: (.*?)[\r\n\f]}i;
is($test_result, 'text/html; charset=UTF-8', "content-type ok: [$test_result]");
($test_result) = $output =~ m{color: (.*?)[\r\n\f]}i;
is($test_result, 'red', "custom header ok: [$test_result]");
print $output;
view all matches for this distribution
view release on metacpan or search on metacpan
htdocs/assets/templates/marpax/grammar/graphviz2/graphviz2.index.tx view on Meta::CPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = 'http://www.w3.org/1999/xhtml' xml:lang = 'en' lang = 'en'>
<head>
<title>Index of sample files created by MarpaX::Grammar::GraphViz2 V <: $version :></title>
<meta http-equiv = 'content-type' content='text/html;charset=utf-8' />
<meta http-equiv = 'cache-control' content='no-cache'>
<meta http-equiv = 'pragma' content='no-cache'>
<link rel = 'stylesheet' type = 'text/css' href = '<: $default_css :>'>
<link rel = 'stylesheet' type = 'text/css' href = '<: $fancy_table_css :>'>
</head>
view all matches for this distribution
view release on metacpan or search on metacpan
hoons/arvo/app/dojo.hoon view on Meta::CPAN
(dy-rash %sag p.p.mad q.q.cay)
::
$http
?> ?=($mime p.cay)
=+ mim=;;(mime q.q.cay)
=+ maf=(~(add ja *math:eyre) %content-type (en-mite:mimes:html p.mim))
(dy-eyre /show q.p.mad [r.p.mad p.p.mad maf ~ q.mim])
::
$show
%+ dy-print cay
=+ mar=|.(?:(=(%noun p.cay) ~ [%rose [~ " " ~] >p.cay< ~]~))
view all matches for this distribution
view release on metacpan or search on metacpan
t/jquery-1.10.2.t view on Meta::CPAN
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
t/jquery-1.10.2.t view on Meta::CPAN
});
};
});
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mason/Plugin/WithEncoding.pm view on Meta::CPAN
}
return $result; # will be discarded
};
# we just need to update the content-type header
around 'send_json' => sub {
my $orig = shift;
my $self = shift;
my $data = shift;
lib/Mason/Plugin/WithEncoding.pm view on Meta::CPAN
Output generated by your Mason templates is encoded according to the setting
in C<server.encoding.response>. If no such setting is found, the response is not
encoded. This is the default behaviour of Poet/Mason.
The content-type default header is set according to C<server.default_content_type>.
If no such setting is found, the default header is C<text/html>, as in the default
Poet/Mason setup. This tells the client what encoding to use when decoding our
content, and also (AFAIK) tells the client what encoding to use when sending us
data.
Output sent through C<send_json> is also encoded and the content-type header
set accordingly.
=head2 Caveats
This plugin only works inside a L<Poet> environment.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/NumSeq/OEIS/File.pm view on Meta::CPAN
}
sub _decode_html_charset {
my ($contents) = @_;
# eg. <META http-equiv="content-type" content="text/html; charset=utf-8">
# HTTP::Message has a blob of code for this, using the full HTTP::Parser,
# but a slack regexp should be enough for OEIS pages.
#
if (_HAVE_ENCODE
&& $contents =~ m{<META[^>]+
http-equiv=[^>]+
content-type[^>]+
charset=([a-z0-9-_]+)}isx) {
return Encode::decode($1, $contents, Encode::FB_PERLQQ());
} else {
return $contents;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Matts/Message.pm view on Meta::CPAN
sub _walk_tree {
my $msg = shift;
my ($sub) = @_;
# Munge the whole thing into a big old multipart/mixed thingy.
$msg->header_del('content-type');
my $boundary = "----=_NextPart_000_" . $$ . time;
$msg->header('Content-Type', "multipart/mixed; boundary=\"$boundary\"\n");
$sub->($msg->raw_headers);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Maypole/Manual/Cookbook.pod view on Meta::CPAN
=head3 Displaying pictures
You want to serve a picture, a Word document, or something else which
doesn't have a content type of C<text/html>, out of your database.
B<Solution>: Fill the content and content-type yourself.
Here's a subroutine which displays the C<photo> for either a specified
user or the currently logged in user. We set the C<output> slot of the
Maypole request object: if this is done then the view class is not called
upon to process a template, since we already have some output to display.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MediaWiki/API.pm view on Meta::CPAN
my %headers;
# if we are using the get method ($querystring is set above)
if ( $querystring ) {
$response = $self->{ua}->get( $self->{config}->{api_url} . $querystring, %headers );
} else {
$headers{'content-type'} = 'form-data' if $query->{action} eq 'upload' || $query->{action} eq 'import';
$response = $self->{ua}->post( $self->{config}->{api_url}, $query, %headers );
}
$self->{response} = $response;
# if the request was successful then check the returned content and decode.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mediafire/Api.pm view on Meta::CPAN
);
my %headers = (
'accept-language' => 'ru,en-US;q=0.9,en;q=0.8',
'cache-control' => 'max-age=0',
'content-type' => 'application/x-www-form-urlencoded',
'origin' => 'https://www.mediafire.com',
'referer' => 'https://www.mediafire.com/login/',
'upgrade-insecure-requests' => '1',
);
view all matches for this distribution
view release on metacpan or search on metacpan
examples/mb.pl view on Meta::CPAN
our $HEAD = <<"";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml;charset=UTF-8" />
<title>Mediawiki::Blame/$Mediawiki::Blame::VERSION</title>
<style type="text/css">
fieldset ul {clear: both;}
fieldset div label {float: left; text-align: right; width: 3em;}
fieldset div input {float: right; text-align: left; width: 90%;}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Message/Style.pm view on Meta::CPAN
}
}
# Check if this is a plain text posting or something else.
if(defined $header{'content-type'}
and $header{'content-type'}!~/^text\/plain/i) {
$fault{"Non plaintext content: $header{'content-type'}"}++;
$meta{isbinary}++;
}
if(defined $header{'content-transfer-encoding'}
and $header{'content-transfer-encoding'}!~/^(7bit|8bit|quoted-printable)/i) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Messaging/Message.pm view on Meta::CPAN
error => "an error message",
time => time(),
};
# create a new message with this body
$msg2 = Messaging::Message->new(body => to_json($body));
$msg2->header_field("content-type", "message/error");
$msg2->text(1);
A receiver of such a message can easily decode it:
use JSON qw(from_json);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MetaCPAN/API/Tiny.pm view on Meta::CPAN
$url = "pod/$author/$release/$path";
} else {
croak $error;
}
# check content-type
my %extra = ();
if ( defined ( my $type = $opts{'content-type'} ) ) {
$type =~ m{^ text/ (?: html|plain|x-pod|x-markdown ) $}x
or croak 'Incorrect content-type provided';
$extra{headers}{'content-type'} = $type;
}
$url = $self->{base_url}. "/$url";
my $result = $self->{ua}->get( $url, \%extra );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MetaCPAN/API/POD.pm view on Meta::CPAN
$url = "pod/$author/$release/$path";
} else {
croak $error;
}
# check content-type
my %extra = ();
if ( defined ( my $type = $opts{'content-type'} ) ) {
$type =~ m{^ text/ (?: html|plain|x-pod|x-markdown ) $}x
or croak 'Incorrect content-type provided';
$extra{headers}{'content-type'} = $type;
}
$url = $self->base_url . "/$url";
my $result = $self->ua->get( $url, \%extra );
lib/MetaCPAN/API/POD.pm view on Meta::CPAN
Searches MetaCPAN for a module or a specific release and returns the POD.
Content type can also be specified, like so:
my $result = $mcpan->pod( module => 'Moose', 'content-type' => 'x-pod' );
=head1 AUTHOR
Sawyer X <xsawyerx@cpan.org>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MetaCPAN/Client/File.pm view on Meta::CPAN
my $self = shift;
my $ctype = shift || "plain";
$ctype = lc($ctype);
grep { $ctype eq $_ } qw<html plain x-pod x-markdown>
or croak "wrong content-type for POD requested";
my $name = $self->module->[0]{name};
return unless $name;
require MetaCPAN::Client::Request;
return
MetaCPAN::Client::Request->new->fetch(
"pod/${name}?content-type=text/${ctype}"
);
}
sub source {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/metacpan_favorite.pl view on Meta::CPAN
$data{release} = $release;
}
my $post = to_json( \%data );
my $res = $ua->post(
"https://api.metacpan.org/user/favorite?access_token=$token",
{ content => $post, headers => {'content-type' => 'application/json' }},
);
if ( $res->{success} ) {
say "Favorited $dist";
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Metabase/Client/Simple.pm view on Meta::CPAN
}
sub _error {
my ( $self, $res, $prefix ) = @_;
$prefix ||= "unrecognized error";
if ( ref($res) && $res->{headers}{'content-type'} eq 'application/json' ) {
my $entity = JSON::MaybeXS->new( { ascii => 1 } )->decode( $res->{content} );
return "$prefix\: $entity->{error}";
}
else {
return "$prefix\: " . $res->{reason};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PeakForest/REST_Client/ApiClient.pm view on Meta::CPAN
return join(',', @header);
}
}
# return the content type based on an array of content-type provided
# @param [Array] content_type_array Array fo content-type
# @return String Content-Type (e.g. application/json)
sub select_header_content_type
{
my ($self, @header) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
doc/slides/_index.html view on Meta::CPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><% $ARGS{title} %></title>
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="top" href="index.html" />
<link rel="next" href="<% $ARGS{next} %>" />
<script type="text/javascript" src="space_next.js"></script>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Miril/Theme/Flashyweb.pm view on Meta::CPAN
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Miril</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<style><TMPL_VAR NAME="css"></style>
</head>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mobile/Wurfl.pm view on Meta::CPAN
my $response = $self->{ua}->get(
$self->{wurfl_url},
':content_file' => $tempfile
);
die $response->status_line unless $response->is_success;
if ($response->{_headers}->header('content-type') eq 'application/x-gzip') {
gunzip($tempfile => $self->{wurfl_file}) || die "gunzip failed: $GunzipError\n";
unlink($tempfile);
} elsif ($response->{_headers}->header('content-type') eq 'application/zip') {
unzip($tempfile => $self->{wurfl_file}) || die "unzip failed: $UnzipError\n";
unlink($tempfile);
} else {
move($tempfile, $self->{wurfl_file});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mock/Apache/Emulation.pm view on Meta::CPAN
my $content_type = $r->{content_type};
DEBUG('$r->content_type(%s) => \'%s\'', @_ > 1 ? "'$newval'" : '', $content_type);
if (@_ > 1) {
$r->{content_type} = $newval;
local $Mock::Apache::DEBUG = 0;
$r->header_out('content-type' => $newval);
}
return $content_type;
}
view all matches for this distribution
view release on metacpan or search on metacpan
$resp=GET_BODY('/fetch2?'.$url);
my ($VAR1, $VAR2);
eval "$resp";
cmp_ok length $VAR1, '>', 0, 'got some data';
cmp_ok $VAR2->{STATUS}, '==', 200, 'status==200';
cmp_ok $VAR2->{'content-type'}, 'eq', 'image/jpeg',
'content-type=image/jpeg';
}
$resp=GET_BODY('/fetch3?/data?10');
ok t_cmp $resp, <<'EOF', '/fetch3?/data?10';
nchunks=10
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojito/Model/MetaCPAN.pm view on Meta::CPAN
sub get_synopsis_from_metacpan {
my ($self, $main_module, $pod_url) = @_;
my $pod_url_used = 'release';
# Use markdown format (easy to parse out SYNOPSIS)
# my $format = '?content-type=text/x-markdown';
my $format = '?content-type=text/plain';
my $secondary_pod_url = "https://fastapi.metacpan.org/pod/${main_module}${format}";
if (not $pod_url) {
$pod_url = $secondary_pod_url;
$pod_url_used = 'main_module';
}
lib/Mojito/Model/MetaCPAN.pm view on Meta::CPAN
sub get_description_from_metacpan {
my ($self, $Module) = @_;
my $pod_url =
"http://api.metacpan.org/pod/${Module}?content-type=text/x-markdown";
my $response = $self->http_client->get($pod_url);
if (not $response->{success}) {
#warn "Failed to get URL: $pod_url";
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
};
subtest 'Find attribute with hyphen in name and value' => sub {
my $dom = Mojo::DOM58->new(<<EOF);
<html>
<head><meta http-equiv="content-type" content="text/html"></head>
</html>
EOF
is $dom->find('[http-equiv]')->[0]{content}, 'text/html', 'right attribute';
is $dom->find('[http-equiv]')->[1], undef, 'no result';
is $dom->find('[http-equiv="content-type"]')->[0]{content}, 'text/html',
'right attribute';
is $dom->find('[http-equiv="content-type"]')->[1], undef, 'no result';
is $dom->find('[http-equiv^="content-"]')->[0]{content}, 'text/html',
'right attribute';
is $dom->find('[http-equiv^="content-"]')->[1], undef, 'no result';
is $dom->find('head > [http-equiv$="-type"]')->[0]{content}, 'text/html',
'right attribute';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/DirectoryHandler.pm view on Meta::CPAN
my $dir_page = <<'PAGE';
<html>
<head>
<title>Index of <%= $cur_path %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
table { width:100%; }
td, th{ padding: 0 5px 0 5px }
view all matches for this distribution
view release on metacpan or search on metacpan
share/amqp0-9-1.stripped.extended.xml view on Meta::CPAN
</method>
</class>
<class name="basic" handler="channel" index="60">
<chassis name="server" implement="MUST"/>
<chassis name="client" implement="MAY"/>
<field name="content-type" domain="shortstr"/>
<field name="content-encoding" domain="shortstr"/>
<field name="headers" domain="table"/>
<field name="delivery-mode" domain="octet"/>
<field name="priority" domain="octet"/>
<field name="correlation-id" domain="shortstr"/>
view all matches for this distribution