Skip to content

Commit f97a301

Browse files
committed
add responseHeaders to onResponse
1 parent 2a86258 commit f97a301

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function fetchImpl(url, { onNext, onComplete, onError, ...fetchOptions })
1313
const reader = response.body.getReader();
1414
const textDecoder = new TextDecoder();
1515
const patchResolver = new PatchResolver({
16-
onResponse: (r) => onNext(r),
16+
onResponse: (r) => onNext(r, { responseHeaders: response.headers }),
1717
boundary,
1818
});
1919
return reader.read().then(function sendNext({ value, done }) {

src/xhr.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function xhrImpl(url, { method, headers, credentials, body, onNext, onErr
3131
if (contentType.indexOf('multipart/mixed') >= 0) {
3232
isDeferred = true;
3333
boundary = getBoundary(contentType);
34-
patchResolver = new PatchResolver({ onResponse: (r) => onNext(r), boundary });
34+
patchResolver = new PatchResolver({ onResponse: (r) => onNext(r, {}), boundary });
3535
}
3636
} else if (
3737
(this.readyState === this.LOADING || this.readyState === this.DONE) &&
@@ -41,7 +41,7 @@ export function xhrImpl(url, { method, headers, credentials, body, onNext, onErr
4141
patchResolver.handleChunk(chunk);
4242
index = xhr.responseText.length;
4343
} else if (this.readyState === this.DONE && !isDeferred) {
44-
onNext([JSON.parse(xhr.response)]);
44+
onNext([JSON.parse(xhr.response)], {});
4545
onComplete();
4646
}
4747
}

0 commit comments

Comments
 (0)