How to use the @pollyjs/utils.ACTIONS.INTERCEPT 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 Netflix / pollyjs / tests / integration / adapter-tests.js View on Github external
.on('response', req => {
        responseCalled = true;
        expect(req.action).to.not.equal(ACTIONS.INTERCEPT);
      });
github Netflix / pollyjs / packages / @pollyjs / adapter / src / index.js View on Github external
async intercept(pollyRequest, interceptor) {
    pollyRequest.action = ACTIONS.INTERCEPT;
    await pollyRequest._intercept(interceptor);

    if (interceptor.shouldIntercept) {
      return this.onIntercept(pollyRequest, pollyRequest.response);
    }
  }
github Netflix / pollyjs / packages / @pollyjs / core / src / -private / logger.js View on Github external
import { ACTIONS } from '@pollyjs/utils';

const FORMATTED_ACTIONS = {
  [ACTIONS.RECORD]: 'Recorded',
  [ACTIONS.REPLAY]: 'Replayed',
  [ACTIONS.INTERCEPT]: 'Intercepted',
  [ACTIONS.PASSTHROUGH]: 'Passthrough'
};

export default class Logger {
  constructor(polly) {
    this.polly = polly;
    this.groupName = null;
  }

  connect() {
    this._middleware = this.polly.server
      .any()
      .on('error', (...args) => this.logError(...args))
      .on('response', (...args) => this.logRequest(...args));
  }