har-validator-fsless
v1.6.6
Published
Extremely fast HTTP Archive (HAR) validator using JSON Schema
Downloads
9,431
Maintainers
Readme
HAR Validator
Extremely fast HTTP Archive (HAR) validator using JSON Schema.
Install
# to use in cli
npm install --global har-validator
# to use as a module
npm install --save har-validator
Usage
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 ...)
Example
har-validator har.json
har-validator --schema request request.json
API
Validate(data [, callback])
Returns true
or false
.
data:
Object
(Required) a full HAR objectcallback:
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!');
});
Validate.log(data [, callback])
Returns true
or false
.
data:
Object
(Required) a log objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.log(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.cache(data [, callback])
Returns true
or false
.
data:
Object
(Required) a cache objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cache(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.cacheEntry(data [, callback])
Returns true
or false
.
data:
Object
(Required) a "beforeRequest" or "afterRequest" objectscallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cacheEntry(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.content(data [, callback])
Returns true
or false
.
data:
Object
(Required) a content objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.content(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.cookie(data [, callback])
Returns true
or false
.
data:
Object
(Required) a cookie objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cookie(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.creator(data [, callback])
Returns true
or false
.
data:
Object
(Required) a creator objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.creator(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.entry(data [, callback])
Returns true
or false
.
data:
Object
(Required) a entry objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.entry(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.log(data [, callback])
alias of Validate(data [, callback])
Validate.page(data [, callback])
Returns true
or false
.
data:
Object
(Required) a page objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.page(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.pageTimings(data [, callback])
Returns true
or false
.
data:
Object
(Required) a pageTimings objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.pageTimings(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.postData(data [, callback])
Returns true
or false
.
data:
Object
(Required) a postData objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.postData(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.record(data [, callback])
Returns true
or false
.
data:
Object
(Required) a record objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.record(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.request(data [, callback])
Returns true
or false
.
data:
Object
(Required) a request objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.request(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.response(data [, callback])
Returns true
or false
.
data:
Object
(Required) a response objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.cacheEntry(data, function (e, valid) {
if (e) console.log(e.errors)
});
Validate.timings(data [, callback])
Returns true
or false
.
data:
Object
(Required) a timings objectcallback:
Function
gets two arguments (err, valid)
var validate = require('har-validator');
validate.timings(data, function (e, valid) {
if (e) console.log(e.errors)
});