Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes call to deprecated OutgoingMessage.prototype._headers #859

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/fastboot/src/fastboot-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const FastBootHeaders = require('./fastboot-headers');

class FastbootResponse {
constructor(response) {
this.headers = new FastBootHeaders(response._headers);
this.headers = new FastBootHeaders(
typeof response.getHeaders === 'function' ? response.getHeaders() : response._headers
);
this.statusCode = 200;
}
}
Expand Down
8 changes: 5 additions & 3 deletions packages/fastboot/test/fastboot-response-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ describe('FastBootResponse', function() {

beforeEach(function() {
var mockResponse = {
_headers: {
'i-am-a': ['mock header', 'me too'],
cookie: '',
getHeaders() {
return {
'i-am-a': ['mock header', 'me too'],
cookie: '',
};
},
};

Expand Down
6 changes: 5 additions & 1 deletion test-packages/integration-tests/test/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ function dummyRequest() {
};
}
function dummyResponse() {
return { _headers: {} };
return {
getHeaders() {
return {};
},
};
}

describe("FastBoot", function() {
Expand Down