How to use the @pollyjs/utils.ACTIONS.REPLAY 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 / packages / @pollyjs / adapter / src / index.js View on Github external
break;
          // log a warning and continue if expiryStrategy is "warn".
          case EXPIRY_STRATEGIES.WARN:
            console.warn(`[Polly] ${message}`);
            break;
          // throw an error if we encounter an unsupported expiryStrategy.
          default:
            this.assert(
              `Invalid config option passed for "expiryStrategy": "${config.expiryStrategy}"`
            );
            break;
        }
      }

      await this.timeout(pollyRequest, recordingEntry);
      pollyRequest.action = ACTIONS.REPLAY;

      return this.onReplay(
        pollyRequest,
        normalizeRecordedResponse(recordingEntry.response),
        recordingEntry
      );
    }

    if (config.recordIfMissing) {
      return this.record(pollyRequest);
    }

    this.assert(
      'Recording for the following request is not found and `recordIfMissing` is `false`.\n' +
        stringifyRequest(pollyRequest, null, 2)
    );
github Netflix / pollyjs / packages / @pollyjs / persister / src / index.js View on Github external
r =>
        r.recordingId === recordingId &&
        (r.action === ACTIONS.RECORD || r.action === ACTIONS.REPLAY)
    );
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));
  }