We already have a flag that allows us to have errors on recordings. Most of the time we enable the flag recordFailedRequests we still write some code to analyze if the recording has an error type we don't expect, e.g:
return setupRecording({
mutateEntry: input.options?.recordFailedRequests
? (entry) => {
if (![200, 401].includes(entry.response.status)) {
throw new Error(
`${input.name} should only receive 200 and 401 response codes - got ${entry.response.status}`,
);
}
return mutateRecordingEntry(entry);
}
We have done this across different integrations, so why don't we move it to the sdk? What we propose it to have a new field, that maybe could be used as the array in the code before.
export interface SetupRecordingInput {
directory: string;
name: string;
redactedRequestHeaders?: string[];
redactedResponseHeaders?: string[];
mutateEntry?: (entry: any) => void;
mutateRequest?: (request: any) => void;
options?: PollyConfig;
+ allowedErrorCodes?: number[];
}
We already have a flag that allows us to have errors on recordings. Most of the time we enable the flag
recordFailedRequestswe still write some code to analyze if the recording has an error type we don't expect, e.g:We have done this across different integrations, so why don't we move it to the sdk? What we propose it to have a new field, that maybe could be used as the array in the code before.