@har-sdk/core
Version:
The base package can be used to import specification files (i.e. HAR, OAS and Postman Collection) and detect their type.
20 lines • 757 B
JavaScript
import { BaseImporter } from './BaseImporter';
import { ImporterType } from './ImporterType';
export class HARImporter extends BaseImporter {
constructor() {
super();
this.SUPPORTED_HAR_VERSION = /^1\.\d+$/; // 1.x
}
get type() {
return ImporterType.HAR;
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
isSupported(spec) {
var _a;
const version = (_a = spec === null || spec === void 0 ? void 0 : spec.log) === null || _a === void 0 ? void 0 : _a.version;
return !!(typeof version === 'string' &&
this.SUPPORTED_HAR_VERSION.test(version.trim()) &&
Array.isArray(spec.log.entries));
}
}
//# sourceMappingURL=HARImporter.js.map