view release on metacpan or search on metacpan
t/two-posts.t view on Meta::CPAN
use Dancer::Test;
use HTTP::Headers;
my $head = HTTP::Headers->new;
$head->header("content-type" => "application/json");
for ( 1..2 ) {
my $resp = dancer_response( 'POST' => '/foo.json', {
body => '{"yin":"yang","foo":"bar"}',
headers => $head,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/RESTModel.pm view on Meta::CPAN
=item * data - The data structure to send (hashref, arrayref). The data will
be encoded according to the value of the I<type> attribute
=item * args - B<optional> hashref with arguments to augment the way the call
is handled. It currently provides the 'deserializer' key to change the
deserializer if you I<know> that the response's content-type is incorrect,
and also the 'preserve_headers' which, if set to true, will keep the headers
between calls:
my $res = model('MyData')->post(
'users/123',
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 = dancer_response(
POST => '/db/person',
{
headers => [ Origin => 'http://localhost' ],
body => to_json(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/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/Dancer/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
lib/Dancer/Plugin/Swagger.pm view on Meta::CPAN
},
get '/judge/:judge_name' => { ... };
If the key C<example> is given (instead of C<examples> as defined by the Swagger specs),
and the serializer used by the application is L<Dancer::Serializer::JSON> or L<Dancer::Serializer::YAML>,
the example will be expanded to have the right content-type key.
swagger_path {
responses => {
default => { example => { fullname => 'Mary Ann Murphy' } }
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Tapir.pm view on Meta::CPAN
else {
$status ||= 500;
$response = $json_xs->encode({ $result_key => $result_value });
}
header 'content-type' => 'application/json';
status $status;
return $response;
};
my $wrapper_sub = sub {
lib/Dancer/Plugin/Tapir.pm view on Meta::CPAN
}
else {
$logger->error("$ex");
$result = $json_xs->encode({ exception => "$ex" });
}
header 'content-type' => 'application/json';
status $status;
};
# Returning the result will print it to the HTTP response
return $result;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Thumbnail.pm view on Meta::CPAN
if ( ( header('If-Modified-Since') || '' ) eq $lmod ) {
status 304;
return;
}
# target format & content-type
my $mime = Dancer::MIME->instance;
my $fmt = $opts->{ format } || $conf->{ format } || 'auto';
my $type = $fmt eq 'auto' ?
$mime->for_file( $file ) :
$mime->for_name( $fmt )
view all matches for this distribution
view release on metacpan or search on metacpan
bin/index-ical.pl view on Meta::CPAN
index => $full_name,
type => 'file', # or 'attachment' ?!
#id => $msg->messageid,
id => $msg->{uid},
# index bcc, cc, to, from
# content-type, ...
body => { # "body" for non-bulk, "source" for bulk ...
#source => {
url => $msg->{url},
title => $msg->{summary} . "($calendar_def->{name})",
title_suggest => $msg->{title_suggest}, # ugh
view all matches for this distribution
view release on metacpan or search on metacpan
t/apps/Foo/public/javascripts/jquery.js view on Meta::CPAN
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&...
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);r...
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._...
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var ...
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f)...
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){...
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n===...
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","padd...
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;f...
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments)...
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.repl...
view all matches for this distribution
view release on metacpan or search on metacpan
t/apps/Foo/public/javascripts/jquery.js view on Meta::CPAN
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&...
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);r...
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._...
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var ...
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f)...
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){...
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n===...
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","padd...
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;f...
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments)...
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.repl...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer2/Plugin/Ajax.pm view on Meta::CPAN
# ...
}
=head1 CONFIGURATION
By default the plugin will use a content-type of 'text/xml', but this can be overridden
with the plugin setting C<content_type>.
Here is an example to use JSON:
plugins:
view all matches for this distribution
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/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
lib/Dancer2/Core/Response.pm view on Meta::CPAN
=head2 serialize( $content )
$response->serialize( $content );
Serialize and return $content with the response's serializer.
set content-type accordingly.
=head2 header($name)
Return the value of the given header, if present. If the header has multiple
values, returns the list of values if called in list context, the first one
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::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