Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
);
r =>
r.recordingId === recordingId &&
(r.action === ACTIONS.RECORD || r.action === ACTIONS.REPLAY)
);
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));
}