Skip to content

Commit

Permalink
fix(adapter-xhr): Only modify the responseType if it was changed (#363
Browse files Browse the repository at this point in the history
)
  • Loading branch information
offirgolan authored Sep 7, 2020
1 parent d0be745 commit cff4e2d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/@pollyjs/adapter-xhr/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ export default class XHRAdapter extends Adapter {
);

xhr.async = fakeXhr.async;
xhr.responseType = BINARY_RESPONSE_TYPES.includes(fakeXhr.responseType)
? 'arraybuffer'
: 'text';

if (BINARY_RESPONSE_TYPES.includes(fakeXhr.responseType)) {
xhr.responseType = 'arraybuffer';
}

if (fakeXhr.async) {
xhr.timeout = fakeXhr.timeout;
Expand Down

0 comments on commit cff4e2d

Please sign in to comment.