view release on metacpan or search on metacpan
lib/Dancer2/Plugin/CSRFI.pm view on Meta::CPAN
If provided, template token with csrf token will be set.
=head3 validate_post
If true, token will be automatically validates each post request with
content-types application/x-www-form-urlencoded or multipart/form-data.
=head3 field_name
Filed name in body-parameters sent with post request, where this module will try
to find csrf token, when validate_post is enabled.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/DoFile.pm view on Meta::CPAN
}
}
}
if (defined $result && ref $result eq 'HASH') {
$result->{'content-type'} = $acceptext->{$fmt};
$stash->{dofiles}->{$cururl.$m.$acceptext->{$fmt}.$ext}->{last} = 1;
return $result;
} elsif (ref $result eq 'ARRAY') {
$stash->{dofiles}->{$cururl.$m.$acceptext->{$fmt}.$ext}->{last} = 1;
return { 'content-type' => $acceptext->{$fmt}, content => $result };
} elsif (!ref $result && $result) {
# do we assume this is HTML? Or a file to use in templating? Who knows!
$stash->{dofiles}->{$cururl.$m.$acceptext->{$fmt}.$ext}->{last} = 1;
return { 'content-type' => $acceptext->{$fmt}, content => $result };
}
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/HTTP/Bundle.pm view on Meta::CPAN
use Dancer2::Plugin::HTTP:::Bundle
get '/secrets/:id' => http_auth_handler_can('find_something') => sub {
# what content-type does the client want
http_choose_accept (
[ 'application/json', 'application/xml' ] => sub {
# find the resource
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/LogReport.pod view on Meta::CPAN
}, {
content_type => 'application/json; charset=UTF-8',
});
};
» example: Return JSON responses for requests with content-type of application/json
fatal_handler sub {
my ($dsl, $msg, $reason, $default) = @_;
(my $ctype = $dsl->request->header('content-type')) =~ s/;.*//;
return if $ctype ne 'application/json';
status $reason eq 'PANIC' ? 'Internal Server Error' : 'Bad Request';
$dsl->send_as(JSON => {
error => 1,
description => $msg->toString,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/OpenAPI.pm view on Meta::CPAN
get '/judge/:judge_name' => { ... };
If the key C<example> is given (instead of C<examples> as defined by the OpenAPI specs),
and the serializer used by the application is L<Dancer2::Serializer::JSON> or L<Dancer2::Serializer::YAML>,
the example will be expanded to have the right content-type key.
openapi_path {
responses => {
default => { example => { fullname => 'Mary Ann Murphy' } }
},
view all matches for this distribution
view release on metacpan or search on metacpan
t/125-restish.t view on Meta::CPAN
"get_all_persons()"
) or diag(explain($response3->content));
}
{ # test with non JSON body (no content-type)
my $response = $tester->request(
HTTP::Request->new(
POST => '/db/person',
[ Origin => 'http://localhost' ],
to_json(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/RPCPlugin/DefaultRoute.pm view on Meta::CPAN
=head3 Responses
All responeses will have B<status: 200 OK>
The B<content-type> (and B<body>) of the request determine the error-response:
=over
=item B<text/xml>
lib/Dancer2/RPCPlugin/DefaultRoute.pm view on Meta::CPAN
'error': {
'code': -32601,
'message': "Method '$request->path' not found"
}
=item B<other/content-type>
Any other content-type is outside the scope of the service. We can respond in
any way we like. For the moment it will be:
status(404)
content_type('text/plain')
body => "Error! '$request->path' was not found for '$request->content_type'"
view all matches for this distribution
view release on metacpan or search on metacpan
t/Dancer2-Serializer-XML.t view on Meta::CPAN
# Test 5: check content type is right
is(
$serializer->content_type,
'application/xml',
'content-type is set correctly',
);
view all matches for this distribution
view release on metacpan or search on metacpan
share/assets/dash_renderer/dash_renderer.dev.js view on Meta::CPAN
this._bodyArrayBuffer = bufferClone(body)
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type', 'text/plain;charset=UTF-8')
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type)
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
}
}
}
if (support.blob) {
share/assets/dash_renderer/dash_renderer.dev.js view on Meta::CPAN
id: id,
status: 'loading'
}
});
return request[method](url, config.fetch, body).then(function (res) {
var contentType = res.headers.get('content-type');
if (contentType && contentType.indexOf('application/json') !== -1) {
return res.json().then(function (json) {
dispatch({
type: store,
view all matches for this distribution
view release on metacpan or search on metacpan
t/data/server-status.html view on Meta::CPAN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Apache Status</title>
</head><body>
<h1>Apache Server Status for localhost</h1>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Debug.pm view on Meta::CPAN
Caller trace returned as an arrayref. Suitable for use like "debug caller_trace".
This does require at least perl 5.8.0's Carp.
=head2 content_typed()
Return truth if a content-type was sent
=head2 set_deparse()
set $DEPARSE=1
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Decode/Encode/HTTP/Response/Parser.pm view on Meta::CPAN
sub _parse_meta
{
my ($self, $tag, $attrs) = @_;
return unless $tag eq 'meta';
return unless $attrs->{'http-equiv'} &&
lc($attrs->{'http-equiv'}) eq 'content-type';
my $content = $attrs->{content};
if (defined $content && $content =~ /charset=([A-Za-z0-9_\-]+)/i) {
push @{ $self->{encodings} }, $1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
share/jquery-3.7.1/jquery-3.7.1.min.js view on Meta::CPAN
/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof windo...
view all matches for this distribution
view release on metacpan or search on metacpan
doc/rfc2445.txt view on Meta::CPAN
systems. It is heavily based on the earlier [VCAL] industry
specification.
3.7 Applications Which Use This Media Type
This content-type is designed for widespread use by Internet
calendaring and scheduling applications. In addition, applications in
the workflow and document management area might find this content-
type applicable. The [ITIP] and [IMIP] Internet protocols directly
use this content-type also. Future work on an Internet calendar
access protocol will utilize this content-type too.
3.8 Additional Information
This memo defines this content-type.
3.9 Magic Numbers
None.
doc/rfc2445.txt view on Meta::CPAN
+1-919-555-1234
The following is an example of this property with an alternate
representation of a MIME body part containing the contact
information, such as a vCard [RFC 2426] embedded in a [MIME-DIR]
content-type:
CONTACT;ALTREP="CID=<part3.msg970930T083000SILVER@host.com>":Jim
Dolittle\, ABC Industries\, +1-919-555-1234
The following is an example of this property referencing a network
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Riak/Fast/Result.pm view on Meta::CPAN
'value' => 'content',
'header' => 'header',
'headers' => 'headers',
# curried delegation
'etag' => [ 'header' => 'etag' ],
'content_type' => [ 'header' => 'content-type' ],
'vector_clock' => [ 'header' => 'x-riak-vclock' ],
'last_modified' => [ 'header' => 'last_modified' ]
}
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Riak/HTTP/Response.pm view on Meta::CPAN
} @{ $self->parts };
}
my %header_values = (
etag => 'etag',
content_type => 'content-type',
vector_clock => 'x-riak-vclock',
last_modified => 'last_modified',
);
sub _create_result {
view all matches for this distribution
view release on metacpan or search on metacpan
Rlist.pm.html view on Meta::CPAN
<?xml version="1.0" ?>
<!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">
<head>
<title>Random-Lists</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:rurban@x-ray.at" />
</head>
<body style="background-color: white">
view all matches for this distribution
view release on metacpan or search on metacpan
<?xml version="1.0" ?>
<!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">
<head>
<title>Data::Roundtrip - convert between Perl data structures, YAML and JSON with unicode support (I believe ...)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:andreas@fedora.(none)" />
</head>
<body>
view all matches for this distribution
view release on metacpan or search on metacpan
<?xml version="1.0" ?>
<!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">
<head>
<title>Data::Table::Excel - Convert between Data::Table objects and Excel files.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@gold.nonet" />
</head>
<body style="background-color: white">
view all matches for this distribution
view release on metacpan or search on metacpan
<?xml version="1.0" ?>
<!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">
<head>
<title>Data::Table - Data type related to database tables, spreadsheets, CSV/TSV files, HTML table displays, etc.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:tlehrman@pc-lj-c7build.lj.gnf.org" />
</head>
<body>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TableReader.pm view on Meta::CPAN
# not documented....
# Dancer & Dancer2 have ->headers => HASH
# Mojo has ->headers => Mojo::Headers
$headers= $input->headers;
}
# the full content-type header, where the user-supplied '$ct' may only be the portion before ';'
my $full_ct= defined $ct && $ct =~ /;/ ? $ct : undef;
if (!defined $full_ct && $headers) {
# Dancer uses hashref of headers, case-normalized
if (ref $headers eq 'HASH') {
my $ct_key= defined $headers->{'Content-Type'}? 'Content-Type'
lib/Data/TableReader.pm view on Meta::CPAN
elsif (blessed($headers) && $headers->can('header')) {
$full_ct= $headers->header('Content-Type');
}
$full_ct= lc($full_ct) if defined $full_ct;
}
# Extract charset and content type from full content-type header.
# But, don't if the user supplied a content-type value and it doesn't match the HTTP header.
if (defined $full_ct && $full_ct =~ /^\s*([^;\s]+)/ && (!defined $ct || $ct eq $full_ct || $ct eq $1)) {
$ct= $1;
if (!defined $charset && $full_ct =~ /;\s*charset\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^;\s]+))/i) {
# Could remove the '\\' escapes, but any value that has escapes will be an invalid
# charset anyway.
lib/Data/TableReader.pm view on Meta::CPAN
for my $cls (grep $_->can('detect_input_format'), @_decoder_classes) {
my @answer= $cls->detect_input_format($self, $hints);
return @answer if @answer;
}
# Lacking a content-type, fall back to probing the contents of the file.
my $content_head= $self->_get_content_head($hints);
# Excel is obvious so check it first. This handles cases where an excel file is
# erroneously named ".csv" and silliness like that.
if (defined $content_head) {
lib/Data/TableReader.pm view on Meta::CPAN
)\z/xi) {
return ($^R, defined $charset? (encoding => $charset) : ());
}
# Try to decide between CSV or TSV or HTML based on content alone.
# To do this, we also have to guess the content-type if it wasn't supplied.
if (defined $content_head && length $content_head) {
$self->_log->('debug',"Probing file format because no known filename suffix");
} else {
my $reason= defined $content_head? "empty file" : "unseekable file handle";
$self->_log->('debug',"Can't probe $reason");
lib/Data/TableReader.pm view on Meta::CPAN
This is used internally to detect the format of a file, but you can call it manually if you
like. The following hints can be supplied as a hashref:
{ http_headers => ..., # hashref or various objects representing HTTP headers
content_type => ..., # a MIME content-type, optional charset
charset => ..., # a character set, as seen in charset=X on a MIME type
filename => ..., # filename, using file extension to guess content-type
content_head => ..., # the first block(s) of the file, to probe magic numbers
content_ofs => ..., # a byte offset from which the input file should be read
}
Missing hints will be pulled from L</input> if possible, updating the supplied hashref.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/table1.cgi view on Meta::CPAN
#use lib '../blib/lib/';
#use lib '../lib/';
use Data::Tabular;
print "content-type: text/html\n\n";
our ($t1);
print q(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
view all matches for this distribution
view release on metacpan or search on metacpan
docs/Common.html view on Meta::CPAN
<!DOCTYPE html> <html> <head> <title>Common.pm</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></...
<span class="k">use</span> <span class="mf">5.8.0</span><span class="p">;</span>
<span class="k">use</span> <span class="nn">Any::</span><span class="n">Moose</span><span class="p">;</span>
<span class="k">use</span> <span class="nn">Data::Validate::</span><span class="n">Domain</span> <span class="sx">qw//</span><span class="p">;</span>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DataTables.pm view on Meta::CPAN
$dt->print_json();
I recommend using this method to display the information
back to the browser once you've set up the DataTables object.
It not only prints the json out, but also takes care of printing
the content-type header back to the browser.
=head2 json
my $json = $dt->json();
print "Content-type: application/json\n\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Date/Calc/Endpoints.html view on Meta::CPAN
<?xml version="1.0" ?>
<!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">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@osx300.apple.com" />
</head>
<body style="background-color: white">
view all matches for this distribution
view release on metacpan or search on metacpan
WeekOfYear.html view on Meta::CPAN
<?xml version="1.0" ?>
<!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">
<head>
<title>Date::WeekOfYear - Simple routine to return the ISO 8601 week of the year (as well as the ISO week year)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
view all matches for this distribution
view release on metacpan or search on metacpan
# HTML header
print <<"EOT";
<html>
<head><title>$labels{calendar}</title>
<meta http-equiv='content-type' content='Text/html; charset=utf-8' />
</head>
<body>
EOT
print qq(<p align='center'><img src='$pict'>\n) if $pict;
# Column headers for the first six months
view all matches for this distribution
view release on metacpan or search on metacpan
examples/web/jquery-1.5.2.js view on Meta::CPAN
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
examples/web/jquery-1.5.2.js view on Meta::CPAN
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
examples/web/jquery-1.5.2.js view on Meta::CPAN
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// 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/Deplide/RFID/EPCISSubmitter.pm view on Meta::CPAN
my $self = shift;
my $message = shift;
my $request = HTTP::Request::Common::POST($self->{_url});
$request->content($message);
$request->header('content-type' => 'application/xml');
$request->header('content-length' => length($message));
$request->authorization_basic($self->{_user}, $self->{_password});
my $response = $self->{_ua}->request($request);
return $response;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/SizeMe/Graph/static/jquery-1.8.1-min.js view on Meta::CPAN
/*! jQuery v@1.8.1 jquery.com | jquery.org/license */
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d=...
view all matches for this distribution