How to use the @pollyjs/utils.ACTIONS.RECORD 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
async record(pollyRequest) {
    pollyRequest.action = ACTIONS.RECORD;

    if ('navigator' in global && !navigator.onLine) {
      console.warn(
        '[Polly] Recording may fail because the browser is offline.\n' +
          `${stringifyRequest(pollyRequest)}`
      );
    }

    return this.onRecord(pollyRequest);
  }
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));