Archive-Har
view release on metacpan or search on metacpan
t/firebug_cookies_n_cache.t view on Meta::CPAN
"value": "5128"
},
{
"name": "Age",
"value": "59687"
}
],
"content": {
"mimeType": "text/css",
"size": 33756,
"text": "/* Copyright 2012 Google Inc. All Rights Reserved. */\n.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inlin...
},
"redirectURL": "",
"headersSize": 387,
"bodySize": 5128
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 134,
t/httpwatch_cookies_n_cache.t view on Meta::CPAN
},
{
"name" : "X-XSS-Protection",
"value" : "1; mode=block"
}
],
"content" : {
"size" : 33756,
"compression" : 28628,
"mimeType" : "text/css; charset=utf-8",
"text" : "/* Copyright 2012 Google Inc. All Rights Reserved. */\n.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{...
},
"redirectURL" : "",
"headersSize" : 388,
"bodySize" : 5128
},
"cache" : {
"beforeRequest" : null,
"afterRequest" : {
"expires" : "2012-05-02T07:50:40.000Z",
"lastAccess" : "2012-04-03T22:13:52.000Z",
t/mandatory_optional.t view on Meta::CPAN
ok($hash->{log}->{pages}->[0]->{id} eq 'page_0', "page->id is defined as page_0:$hash->{log}->{pages}->[0]->{id}");
ok(length $hash->{log}->{pages}->[0]->{title}, "page->title is defined:$hash->{log}->{pages}->[0]->{title}");
ok((defined $hash->{log}->{pages}->[0]->{pageTimings} and ref $hash->{log}->{pages}->[0]->{pageTimings} eq 'HASH'), "page->pageTimings is defined as a HASH");
ok($hash->{log}->{browser}->{comment} eq "test browser", "comment is correct");
ok($hash->{log}->{browser}->{_private} eq "browser", "_private value is correct");
$har->browser()->_private("value");
$hash = $har->hashref();
ok($hash->{log}->{browser}->{_private} eq "value", "new _private value is correct (1)");
ok($har->browser()->_private() eq "value", "new _private value is correct (2)");
eval { $har->browser()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{creator}->{comment} eq "test creator", "comment is correct");
ok($hash->{log}->{creator}->{_private} eq "creator", "_private value is correct");
$har->creator()->_private("value");
$hash = $har->hashref();
ok($hash->{log}->{creator}->{_private} eq "value", "new _private value is correct (1)");
ok($har->creator()->_private() eq "value", "new _private value is correct (2)");
eval { $har->creator()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
# entries
$checking = <<'_CHECK_';
{
"log": {
"entries": [ { "comment": "test entry", "_private": "entry", "cache": { "comment": "test cache", "_private": "cache", "beforeRequest": { "comment": "test beforeRequest", "_private": "beforeRequest" }, "afterRequest": null } } ]
}
}
_CHECK_
t/mandatory_optional.t view on Meta::CPAN
ok($hash->{log}->{entries}->[0]->{comment} eq "test entry", "comment is correct");
ok($hash->{log}->{entries}->[0]->{_private} eq "entry", "_private value is correct");
(($har->entries())[0])->_private(undef);
$hash = $har->hashref();
ok(!exists $hash->{log}->{entries}->[0]->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->_private("value");
$hash = $har->hashref();
ok($hash->{log}->{entries}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
eval { (($har->entries())[0])->started_date_time("not_formatted") };
ok($@ =~ /^started_date_time is not formatted correctly/, "started_date_time throws an exception with invalid input");
ok($hash->{log}->{entries}->[0]->{cache}->{comment} eq "test cache", "comment is correct");
ok($hash->{log}->{entries}->[0]->{cache}->{_private} eq "cache", "_private is correct");
(($har->entries())[0])->cache()->_private(undef);
$hash = $har->hashref();
ok(!exists $hash->{log}->{entries}->[0]->{cache}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->cache()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{cache}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->cache()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->cache()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{cache}->{beforeRequest}->{comment} eq "test beforeRequest", "comment is correct");
ok($hash->{log}->{entries}->[0]->{cache}->{beforeRequest}->{_private} eq "beforeRequest", "_private is correct");
(($har->entries())[0])->cache()->before_request()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{cache}->{beforeRequest}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->cache()->before_request()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{cache}->{beforeRequest}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->cache()->before_request()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->cache()->before_request()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
eval { (($har->entries())[0])->cache()->before_request()->last_access("not_formatted") };
ok($@ =~ /^last_access is not formatted correctly/, "last_access throws an exception with invalid input");
# request
ok(($hash->{log}->{entries}->[0]->{request}->{method} eq 'GET'), "request->method is GET by default");
ok(($hash->{log}->{entries}->[0]->{request}->{url} eq 'http://example.com/'), "request->url is http://example.com/ by default");
ok(($hash->{log}->{entries}->[0]->{request}->{httpVersion} eq 'HTTP/0.9'), "request->http_version is HTTP/0.9 by default");
ok(($hash->{log}->{entries}->[0]->{request}->{headersSize} == -1), "request->headersSize is -1 by default");
ok(($hash->{log}->{entries}->[0]->{request}->{bodySize} == -1), "request->bodySize is -1 by default");
t/mandatory_optional.t view on Meta::CPAN
ok($hash->{log}->{entries}->[0]->{request}->{comment} eq "test request", "comment is correct");
ok($hash->{log}->{entries}->[0]->{request}->{_private} eq "request", "_private is correct");
(($har->entries())[0])->request()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{request}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->request()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->request()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->request()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{response}->{comment} eq "test response", "comment is correct");
ok($hash->{log}->{entries}->[0]->{response}->{_private} eq "response", "_private is correct");
(($har->entries())[0])->response()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{response}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->response()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{response}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->response()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->response()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{response}->{cookies}->[0]->{comment} eq "test cookie", "comment is correct");
ok($hash->{log}->{entries}->[0]->{response}->{cookies}->[0]->{_private} eq "cookie", "_private is correct");
(((($har->entries())[0])->response()->cookies())[0])->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{response}->{cookies}->[0]->{_private}, "new _private value is correct (2)");
(((($har->entries())[0])->response()->cookies())[0])->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{response}->{cookies}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((((($har->entries())[0])->response()->cookies())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (((($har->entries())[0])->response()->cookies())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{response}->{content}->{comment} eq "test content", "comment is correct");
ok($hash->{log}->{entries}->[0]->{response}->{content}->{_private} eq "content", "_private is correct");
(($har->entries())[0])->response()->content()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{response}->{content}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->response()->content()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{response}->{content}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->response()->content()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->response()->content()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{request}->{headers}->[0]->{comment} eq "test headers", "comment is correct");
ok($hash->{log}->{entries}->[0]->{request}->{headers}->[0]->{_private} eq "headers", "_private is correct");
(((($har->entries())[0])->request()->headers())[0])->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{request}->{headers}->[0]->{_private}, "new _private value is correct (2)");
(((($har->entries())[0])->request()->headers())[0])->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{headers}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((((($har->entries())[0])->request()->headers())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (((($har->entries())[0])->request()->headers())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{comment} eq "test postData", "comment is correct");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{_private} eq "postData", "_private is correct");
(($har->entries())[0])->request()->post_data()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{request}->{postData}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->request()->post_data()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->request()->post_data()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->request()->post_data()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{comment} eq "test params", "comment is correct");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{fileName} eq "example.pdf", "fileName is correct");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{contentType} eq "application/pdf", "contentType is correct");
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{_private} eq "params", "_private is correct");
(((($har->entries())[0])->request()->post_data()->params())[0])->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{_private}, "new _private value is correct (2)");
(((($har->entries())[0])->request()->post_data()->params())[0])->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((((($har->entries())[0])->request()->post_data()->params())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (((($har->entries())[0])->request()->post_data()->params())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{request}->{queryString}->[0]->{comment} eq "test queryString", "comment is correct");
ok($hash->{log}->{entries}->[0]->{request}->{queryString}->[0]->{_private} eq "queryString", "_private is correct");
(((($har->entries())[0])->request()->query_string())[0])->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{entries}->[0]->{request}->{queryString}->[0]->{_private}, "new _private value is correct (2)");
(((($har->entries())[0])->request()->query_string())[0])->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{queryString}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((((($har->entries())[0])->request()->query_string())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (((($har->entries())[0])->request()->query_string())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
ok($hash->{log}->{entries}->[0]->{timings}->{comment} eq "test timings", "comment is correct");
ok($hash->{log}->{entries}->[0]->{timings}->{_private} eq "timings", "_private is correct");
(($har->entries())[0])->timings()->ssl(undef);
(($har->entries())[0])->timings()->blocked(undef);
(($har->entries())[0])->timings()->connect(undef);
(($har->entries())[0])->timings()->dns(undef);
(($har->entries())[0])->timings()->_private(undef);
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{timings}->{ssl} == -1, "timings ssl unavailable is correct");
ok($hash->{log}->{entries}->[0]->{timings}->{blocked} == -1, "timings blocked unavailable is correct");
ok($hash->{log}->{entries}->[0]->{timings}->{connect} == -1, "timings connect unavailable is correct");
ok($hash->{log}->{entries}->[0]->{timings}->{dns} == -1, "timings dns unavailable is correct");
ok(!exists $hash->{log}->{entries}->[0]->{timings}->{_private}, "new _private value is correct (2)");
(($har->entries())[0])->timings()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{timings}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->entries())[0])->timings()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->entries())[0])->timings()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
(($har->entries())[0])->request()->post_data()->text("foobar");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{entries}->[0]->{request}->{postData}->{text} eq "foobar", "postData text is correct");
ok(!exists $hash->{log}->{entries}->[0]->{request}->{postData}->{params}->[0], "postData params does not exist");
$checking = <<'_CHECK_';
{
"log": {
"pages": [ { "comment": "test pages", "_private": "pages", "pageTimings": { "comment": "test pageTimings", "_private": "pageTimings" } } ]
t/mandatory_optional.t view on Meta::CPAN
ok($hash, "Successfully read pages elements in har archive");
ok($hash->{log}->{pages}->[0]->{comment} eq "test pages", "comment is correct");
ok($hash->{log}->{pages}->[0]->{_private} eq "pages", "_private is correct");
(($har->pages())[0])->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{pages}->[0]->{_private}, "new _private value is correct (2)");
(($har->pages())[0])->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{pages}->[0]->{_private} eq "value", "new _private value is correct (3)");
ok((($har->pages())[0])->_private() eq "value", "new _private value is correct (4)");
eval { (($har->pages())[0])->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
(($har->pages())[0])->started_date_time(undef);
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{pages}->[0]->{startedDateTime} eq '0000-00-00T00:00:00.0+00:00', "started_date_time is not defined");
eval { (($har->pages())[0])->started_date_time("not_formatted") };
ok($@ =~ /^started_date_time is not formatted correctly/, "started_date_time throws an exception with invalid input");
ok($hash->{log}->{pages}->[0]->{pageTimings}->{comment} eq "test pageTimings", "comment is correct");
ok($hash->{log}->{pages}->[0]->{pageTimings}->{_private} eq "pageTimings", "_private is correct");
(($har->pages())[0])->page_timings()->_private(undef);
$hash = JSON::decode_json($har->string());
ok(!exists $hash->{log}->{pages}->[0]->{pageTimings}->{_private}, "new _private value is correct (2)");
(($har->pages())[0])->page_timings()->_private("value");
$hash = JSON::decode_json($har->string());
ok($hash->{log}->{pages}->[0]->{pageTimings}->{_private} eq "value", "new _private value is correct (3)");
ok((($har->pages())[0])->page_timings()->_private() eq "value", "new _private value is correct (4)");
eval { (($har->pages())[0])->page_timings()->does_not_exist() };
ok($@ =~ /^does_not_exist is not specified in the HAR 1.2 spec and does not start with an underscore/, "does_not_exist access throws an exception");
eval { (($har->pages())[0])->page_timings()->on_content_load('sdf') };
ok($@ =~ /^on_content_load must be a positive number or -1/, "setting on_content_load to a non numeric throws an exception");
eval { (($har->pages())[0])->page_timings()->on_load('sdf') };
ok($@ =~ /^on_load must be a positive number or -1/, "setting on_load to a non numeric throws an exception");
no warnings;
eval "sub IO::Uncompress::Gunzip::gunzip { return; }";
use warnings;
my $plainData = "asdadsdsfsdF";
my $gzippedData ;
( run in 0.278 second using v1.01-cache-2.11-cpan-94b05bcf43c )