Extremely fast HTTP Archive (HAR) validator using JSON Schema.
# to use in cli
npm install --global har-validator
# to use as a module
npm install --save har-validator
Usage: har-validator [options] <files ...>
Options:
-h, --help output usage information
-V, --version output the version number
-s, --schema [name] validate schema name (log, request, response, etc ...)
har-validator har.json
har-validator --schema request request.json
Returns true
or false
.
-
data:
Object
(Required) a full HAR object -
callback:
Function
gets two arguments (err, valid)
var HAR = require('./har.json');
var validate = require('har-validator');
validate(HAR, function (e, valid) {
if (e) console.log(e.errors)
if (valid) console.log('horray!');
});
Returns true
or false
.
-
data:
Object
(Required) a log object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.log(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a cache object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cache(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a "beforeRequest" or "afterRequest" objects -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cacheEntry(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a content object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.content(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a cookie object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cookie(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a creator object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.creator(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) an entry object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.entry(data, function (e, valid) {
if (e) console.log(e.errors)
});
alias of Validate(data [, callback])
Returns true
or false
.
-
data:
Object
(Required) a page object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.page(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a pageTimings object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.pageTimings(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a postData object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.postData(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a record object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.record(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a request object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.request(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a response object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cacheEntry(data, function (e, valid) {
if (e) console.log(e.errors)
});
Returns true
or false
.
-
data:
Object
(Required) a timings object -
callback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.timings(data, function (e, valid) {
if (e) console.log(e.errors)
});
Donations are welcome to help support the continuous development of this project.