How to use the @pollyjs/utils.MODES.PASSTHROUGH function in @pollyjs/utils

To help you get started, we’ve selected a few @pollyjs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / pollyjs__core / pollyjs__core-tests.ts View on Github external
import { Polly, Timing, setupMocha, setupQunit } from '@pollyjs/core';
import { EXPIRY_STRATEGIES, MODES } from '@pollyjs/utils';

const polly = new Polly('test recording', {
    mode: MODES.PASSTHROUGH,
    recordFailedRequests: true,
    adapters: ['xhr', 'fetch'],
    persister: 'rest',
    expiryStrategy: EXPIRY_STRATEGIES.ERROR,
    timing: Timing.relative(3),
    matchRequestsBy: {
        method: true,
        headers: true,
        body: true,
        order: true,

        url: {
            protocol: true,
            username: true,
            password: true,
            hostname: true,
github Netflix / pollyjs / packages / @pollyjs / adapter / src / index.js View on Github external
async [REQUEST_HANDLER](pollyRequest) {
    const { mode } = this.polly;
    const { _interceptor: interceptor } = pollyRequest;

    if (pollyRequest.shouldIntercept) {
      await this.intercept(pollyRequest, interceptor);

      if (interceptor.shouldIntercept) {
        return;
      }
    }

    if (
      mode === MODES.PASSTHROUGH ||
      pollyRequest.shouldPassthrough ||
      interceptor.shouldPassthrough
    ) {
      return this.passthrough(pollyRequest);
    }

    this.assert(
      'A persister must be configured in order to record and replay requests.',
      !!this.persister
    );

    if (mode === MODES.RECORD) {
      return this.record(pollyRequest);
    }

    if (mode === MODES.REPLAY) {
github Netflix / pollyjs / packages / @pollyjs / core / src / polly.js View on Github external
pause() {
    this[PAUSED_MODE] = this.mode;
    this.mode = MODES.PASSTHROUGH;
  }