mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 00:45:14 +00:00
Update har.js
This commit is contained in:
parent
5ff6680cee
commit
92e611f49a
12
lib/har.js
12
lib/har.js
|
@ -13,10 +13,6 @@ var HARObject = function() {
|
|||
this.entryIndex = index;
|
||||
};
|
||||
|
||||
this.setOnEntry = function(callback) {
|
||||
this.onEntry = callback;
|
||||
};
|
||||
|
||||
this.load = function(filename) {
|
||||
this.filename = filename;
|
||||
this.data = JSON.parse(FILE.readFile(this.filename, PipeIPC.CdoUTF_8));
|
||||
|
@ -24,12 +20,12 @@ var HARObject = function() {
|
|||
return this;
|
||||
};
|
||||
|
||||
this.play = function() {
|
||||
this.play = function(callback) {
|
||||
var entries = this.data.log.entries;
|
||||
while (this.entryIndex < entries.length) {
|
||||
var entry = entries[this.entryIndex];
|
||||
|
||||
if (typeof this.onEntry !== "function") {
|
||||
if (typeof callback !== "function") {
|
||||
console.log(
|
||||
'[' + entry.startedDateTime + ']',
|
||||
'"' + [entry.request.method, entry.request.url, entry.request.httpVersion].join(' ') + '"',
|
||||
|
@ -40,7 +36,7 @@ var HARObject = function() {
|
|||
);
|
||||
} else {
|
||||
try {
|
||||
this.onEntry(this, entry, entry.request, entry.response, this.entryIndex);
|
||||
callback(this, entry, entry.request, entry.response, this.entryIndex);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
|
@ -61,7 +57,7 @@ var HARObject = function() {
|
|||
|
||||
exports.HARObject = HARObject;
|
||||
|
||||
exports.VERSIONINFO = "HAR manipulate and replay tools version 0.1.2";
|
||||
exports.VERSIONINFO = "HAR manipulate and replay tools version 0.1.3";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user