Skip to content

Latest commit

 

History

History
241 lines (168 loc) · 5.74 KB

promise.md

File metadata and controls

241 lines (168 loc) · 5.74 KB

Promise API

import * as validate from 'har-validator'
import * as validate from 'har-validator/lib/promise'
import { request, response } from 'har-validator/lib/promise'

validate.afterRequest(data)

Returns a promise that resolves to the valid object.

validate.afterRequest(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.beforeRequest(data)

Returns a promise that resolves to the valid object.

validate.beforeRequest(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.browser(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a browser object
validate.browser(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.cache(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a cache object
validate.cache(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.content(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a content object
validate.content(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.cookie(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a cookie object
validate.cookie(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.creator(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a creator object
validate.creator(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.entry(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) an entry object
validate.entry(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.har(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a full HAR object
validate.har(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.header(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a header object
validate.header(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.log(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a log object
validate.log(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.page(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a page object
validate.page(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.pageTimings(data)

Returns a promise that resolves to the valid object.

validate.pageTimings(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.postData(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a postData object
validate.postData(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.query(data)

Returns a promise that resolves to the valid object.

validate.query(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.request(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a request object
validate.request(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.response(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a response object
validate.cacheEntry(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)

validate.timings(data)

Returns a promise that resolves to the valid object.

  • data: Object (Required) a timings object
validate.timings(data)
  .then((data) => console.log('✔️'))
  .catch(console.error)