Skip to content

Commit 38e8b50

Browse files
author
Robert Jackson
authored
Merge pull request #859 from SergeAstapov/fix-deprecation
2 parents 8ac1c8d + 1563a86 commit 38e8b50

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/fastboot/src/fastboot-response.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const FastBootHeaders = require('./fastboot-headers');
44

55
class FastbootResponse {
66
constructor(response) {
7-
this.headers = new FastBootHeaders(response._headers);
7+
this.headers = new FastBootHeaders(
8+
typeof response.getHeaders === 'function' ? response.getHeaders() : response._headers
9+
);
810
this.statusCode = 200;
911
}
1012
}

packages/fastboot/test/fastboot-response-test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ describe('FastBootResponse', function() {
77

88
beforeEach(function() {
99
var mockResponse = {
10-
_headers: {
11-
'i-am-a': ['mock header', 'me too'],
12-
cookie: '',
10+
getHeaders() {
11+
return {
12+
'i-am-a': ['mock header', 'me too'],
13+
cookie: '',
14+
};
1315
},
1416
};
1517

test-packages/integration-tests/test/basic-test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ function dummyRequest() {
1818
};
1919
}
2020
function dummyResponse() {
21-
return { _headers: {} };
21+
return {
22+
getHeaders() {
23+
return {};
24+
},
25+
};
2226
}
2327

2428
describe("FastBoot", function() {

0 commit comments

Comments
 (0)