HTTP Archive (HAR) Dynamic Object
MIT License
HTTP Archive (HAR) Dynamic Object, auto generates values & utility methods for easy manipulation and lookup
Date
Objects for all date time fields, automatically converts to ISO formatheadersSize
url
to create queryString
objects and set Host
headerqueryString
is modifiednpm install --save har
var HAR = require('har')
Object
(a log object)
new HAR.Log({
version: 1.2,
creator: creator,
browser: browser,
comment: 'foo',
})
Object
(a page object)
var page = new HAR.Page({
id: 'foo',
title: 'hello world',
startedDateTime: new Date()
})
new HAR.Log().addPage(page)
Object
(an entry object)
var entry = new HAR.Entry({
startedDateTime: new Date(),
request: request,
response: response
})
new HAR.Log().addEntry(entry)
Object
(a "beforeRequest" or "afterRequest" objects)
new HAR.CacheEntry({
eTag: 'foo',
hitCount: 10,
expires: new Date(),
lastAccess: new Date(),
comment: 'foo'
})
Object
(a content object)
new Content({
compression: 20,
mimeType: 'multipart/form-content',
text: 'foo=bar',
encoding: 'base64',
comment: 'hello world'
})
Object
(a cookie object)
new HAR.Cookie({
name: 'foo',
value: 'bar',
path: '/',
domain: 'www.ahmadnassri.com',
expires: date,
httpOnly: true,
secure: true,
comment: 'foo'
})
Object
(a creator object)
new HAR.Creator({
name: 'Node HAR',
version: '1.0'
})
Object
(a browser object)
new HAR.Browser({
name: 'My Browser',
version: '5.0'
})
Object
(an entry object)
new HAR.Entry({
startedDateTime: new Date(),
request: request,
response: response
})
Object
(a header object)
new HAR.Header({
name: 'foo',
value 'bar',
comment: 'foo'
})
Object
(a page object)
new HAR.Page({
id: 'foo',
title: 'hello world',
startedDateTime: new Date(),
pageTimings: {
onLoad: 0,
onContentLoad: 0
},
comment: 'foo'
})
Object
(a postData Param object)
new HAR.Param({
comment: 'hello',
contentType: 'text/plain',
fileName: 'foo.bar',
name: 'foo',
value: 'bar'
})
Object
(a postData object)
new HAR.PostData({
comment: 'hello world',
mimeType: 'multipart/form-data',
text: 'foo=bar'
})
Object
(a postData object)
new HAR.PostData().addParam(param)
Object
(a query object)
new HAR.Header({
name: 'foo',
value 'bar',
comment: 'foo'
})
Object
(a request object)
Automatically Calculated Values:
headersSize
bodySize
var request = new HAR.Request({
url: 'https://ahmadnassri.github.io/har-resources/',
headers: [
new Header('foo', 'bar')
],
postData: new PostData({
mimeType: 'text/plain',
text: 'foo'
})
})
// request.headersSize === 44
// request.bodySize === 3
Object
(a cookie object)
new HAR.Request().addCookie(cookie)
Object
(a header object)
new HAR.Request().addHeader(header)
Object
(a queryString object)
new HAR.Request().addQuery(query)
Object
(a response object)
Automatically Calculated Values:
headersSize
bodySize
content.size
var response = new HAR.Response({
status: 200,
statusText: 'OK'
headers: [
new Header('foo', 'bar')
],
content: new PostData({
text: 'foo'
})
})
// response.headersSize === 12
// response.bodySize === 3
// response.content.size === 3
Object
(a cookie object)
new HAR.Response().addCookie(cookie)
Object
(a header object)
new HAR.Response().addHeader(header)
Donations are welcome to help support the continuous development of this project.