api documentation for nock (v9.0.9)

HTTP Server mocking for Node.js

table of contents

  1. module nock
    1. function nock.activate ()
    2. function nock.activeMocks ()
    3. function nock.back (fixtureName, options, nockedFn)
    4. function nock.cleanAll ()
    5. function nock.define (nockDefs)
    6. function nock.delayed_body (ms, body)
    7. function nock.disableNetConnect ()
    8. function nock.enableNetConnect (matcher)
    9. function nock.intercept (key, interceptor, scope, scopeOptions, host)
    10. function nock.interceptor (scope, uri, method, requestBody, interceptorOptions)
    11. function nock.isActive ()
    12. function nock.isDone ()
    13. function nock.load (path)
    14. function nock.loadDefs (path)
    15. function nock.pendingMocks ()
    16. function nock.removeInterceptor (options)
    17. function nock.restore ()
    18. function nock.socket (options)
    19. object nock.common
    20. object nock.delayed_body.prototype
    21. object nock.emitter
    22. object nock.interceptor.prototype
    23. object nock.recorder
    24. object nock.socket.prototype
  2. module nock.back
    1. function nock.back (fixtureName, options, nockedFn)
    2. function nock.back.setMode (mode)
    3. object nock.back.fixtures
    4. string nock.back.currentMode
  3. module nock.common
    1. function nock.common.contentEncoding (headers, encoder)
    2. function nock.common.deleteHeadersField (headers, fieldNameToDelete)
    3. function nock.common.formatQueryValue (key, value, options)
    4. function nock.common.headersArrayToObject (rawHeaders)
    5. function nock.common.headersFieldNamesToLowerCase (headers)
    6. function nock.common.headersFieldsArrayToLowerCase (headers)
    7. function nock.common.isBinaryBuffer (buffer)
    8. function nock.common.isContentEncoded (headers)
    9. function nock.common.isJSONContent (headers)
    10. function nock.common.isStream (obj)
    11. function nock.common.matchStringOrRegexp (target, pattern)
    12. function nock.common.mergeChunks (chunks)
    13. function nock.common.normalizeRequestOptions (options)
    14. function nock.common.overrideRequests (newRequest)
    15. function nock.common.percentDecode (str)
    16. function nock.common.percentEncode (str)
    17. function nock.common.restoreOverriddenRequests ()
    18. function nock.common.stringifyRequest (options, body)
  4. module nock.delayed_body
    1. function nock.delayed_body (ms, body)
    2. function nock.delayed_body.super_ (options)
  5. module nock.delayed_body.prototype
    1. function nock.delayed_body.prototype._transform (chunk, encoding, cb)
  6. module nock.intercept
    1. function nock.intercept (key, interceptor, scope, scopeOptions, host)
    2. function nock.intercept.activate ()
    3. function nock.intercept.activeMocks ()
    4. function nock.intercept.disableNetConnect ()
    5. function nock.intercept.enableNetConnect (matcher)
    6. function nock.intercept.isActive ()
    7. function nock.intercept.isDone ()
    8. function nock.intercept.isOn ()
    9. function nock.intercept.overrideClientRequest ()
    10. function nock.intercept.pendingMocks ()
    11. function nock.intercept.removeAll ()
    12. function nock.intercept.removeInterceptor (options)
    13. function nock.intercept.restoreOverriddenClientRequest ()
  7. module nock.interceptor
    1. function nock.interceptor (scope, uri, method, requestBody, interceptorOptions)
  8. module nock.interceptor.prototype
    1. function nock.interceptor.prototype.basicAuth (options)
    2. function nock.interceptor.prototype.delay (opts)
    3. function nock.interceptor.prototype.delayBody (ms)
    4. function nock.interceptor.prototype.delayConnection (ms)
    5. function nock.interceptor.prototype.discard ()
    6. function nock.interceptor.prototype.filteringPath ()
    7. function nock.interceptor.prototype.getTotalDelay ()
    8. function nock.interceptor.prototype.match (options, body, hostNameOnly)
    9. function nock.interceptor.prototype.matchHeader (name, value)
    10. function nock.interceptor.prototype.matchIndependentOfBody (options)
    11. function nock.interceptor.prototype.once ()
    12. function nock.interceptor.prototype.optionally ()
    13. function nock.interceptor.prototype.query (queries)
    14. function nock.interceptor.prototype.reply (statusCode, body, rawHeaders)
    15. function nock.interceptor.prototype.replyWithError (errorMessage)
    16. function nock.interceptor.prototype.replyWithFile (statusCode, filePath, headers)
    17. function nock.interceptor.prototype.reqheaderMatches (options, key)
    18. function nock.interceptor.prototype.socketDelay (ms)
    19. function nock.interceptor.prototype.thrice ()
    20. function nock.interceptor.prototype.times (newCounter)
    21. function nock.interceptor.prototype.twice ()
  9. module nock.recorder
    1. function nock.recorder.clear ()
    2. function nock.recorder.play ()
    3. function nock.recorder.rec (rec_options)
  10. module nock.socket
    1. function nock.socket (options)
    2. function nock.socket.super_ ()
  11. module nock.socket.prototype
    1. function nock.socket.prototype.applyDelay (delayMs)
    2. function nock.socket.prototype.destroy ()
    3. function nock.socket.prototype.getPeerCertificate ()
    4. function nock.socket.prototype.setTimeout (timeoutMs, fn)

module nock

function nock.activate ()

function nock.activeMocks ()

function nock.back (fixtureName, options, nockedFn)

function nock.cleanAll ()

function nock.define (nockDefs)

function nock.delayed_body (ms, body)

function nock.disableNetConnect ()

function nock.enableNetConnect (matcher)

function nock.intercept (key, interceptor, scope, scopeOptions, host)

function nock.interceptor (scope, uri, method, requestBody, interceptorOptions)

function nock.isActive ()

function nock.isDone ()

function nock.load (path)

function nock.loadDefs (path)

function nock.pendingMocks ()

function nock.removeInterceptor (options)

function nock.restore ()

function nock.socket (options)

module nock.back

function nock.back (fixtureName, options, nockedFn)

function nock.back.setMode (mode)

module nock.common

function nock.common.contentEncoding (headers, encoder)

function nock.common.deleteHeadersField (headers, fieldNameToDelete)

function nock.common.formatQueryValue (key, value, options)

function nock.common.headersArrayToObject (rawHeaders)

function nock.common.headersFieldNamesToLowerCase (headers)

function nock.common.headersFieldsArrayToLowerCase (headers)

function nock.common.isBinaryBuffer (buffer)

function nock.common.isContentEncoded (headers)

function nock.common.isJSONContent (headers)

function nock.common.isStream (obj)

function nock.common.matchStringOrRegexp (target, pattern)

function nock.common.mergeChunks (chunks)

function nock.common.normalizeRequestOptions (options)

function nock.common.overrideRequests (newRequest)

function nock.common.percentDecode (str)

function nock.common.percentEncode (str)

function nock.common.restoreOverriddenRequests ()

function nock.common.stringifyRequest (options, body)

module nock.delayed_body

function nock.delayed_body (ms, body)

function nock.delayed_body.super_ (options)

module nock.delayed_body.prototype

function nock.delayed_body.prototype._transform (chunk, encoding, cb)

module nock.intercept

function nock.intercept (key, interceptor, scope, scopeOptions, host)

function nock.intercept.activate ()

function nock.intercept.activeMocks ()

function nock.intercept.disableNetConnect ()

function nock.intercept.enableNetConnect (matcher)

function nock.intercept.isActive ()

function nock.intercept.isDone ()

function nock.intercept.isOn ()

function nock.intercept.overrideClientRequest ()

function nock.intercept.pendingMocks ()

function nock.intercept.removeAll ()

function nock.intercept.removeInterceptor (options)

function nock.intercept.restoreOverriddenClientRequest ()

module nock.interceptor

function nock.interceptor (scope, uri, method, requestBody, interceptorOptions)

module nock.interceptor.prototype

function nock.interceptor.prototype.basicAuth (options)

function nock.interceptor.prototype.delay (opts)

function nock.interceptor.prototype.delayBody (ms)

function nock.interceptor.prototype.delayConnection (ms)

function nock.interceptor.prototype.discard ()

function nock.interceptor.prototype.filteringPath ()

function nock.interceptor.prototype.getTotalDelay ()

function nock.interceptor.prototype.match (options, body, hostNameOnly)

function nock.interceptor.prototype.matchHeader (name, value)

function nock.interceptor.prototype.matchIndependentOfBody (options)

function nock.interceptor.prototype.once ()

function nock.interceptor.prototype.optionally ()

function nock.interceptor.prototype.query (queries)

function nock.interceptor.prototype.reply (statusCode, body, rawHeaders)

function nock.interceptor.prototype.replyWithError (errorMessage)

function nock.interceptor.prototype.replyWithFile (statusCode, filePath, headers)

function nock.interceptor.prototype.reqheaderMatches (options, key)

function nock.interceptor.prototype.socketDelay (ms)

function nock.interceptor.prototype.thrice ()

function nock.interceptor.prototype.times (newCounter)

function nock.interceptor.prototype.twice ()

module nock.recorder

function nock.recorder.clear ()

function nock.recorder.play ()

function nock.recorder.rec (rec_options)

module nock.socket

function nock.socket (options)

function nock.socket.super_ ()

module nock.socket.prototype

function nock.socket.prototype.applyDelay (delayMs)

function nock.socket.prototype.destroy ()

function nock.socket.prototype.getPeerCertificate ()

function nock.socket.prototype.setTimeout (timeoutMs, fn)

[ this document was created with utility2 ]