Skip to content

Commit 881e35f

Browse files
committed
Removes call to deprecated OutgoingMessage.prototype._headers
1 parent 7a9dd6c commit 881e35f

File tree

7 files changed

+147
-55
lines changed

7 files changed

+147
-55
lines changed

packages/fastboot/src/fastboot-response.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
'use strict';
2+
/* eslint-disable no-console */
23

34
const FastBootHeaders = require('./fastboot-headers');
45

56
class FastbootResponse {
67
constructor(response) {
7-
this.headers = new FastBootHeaders(response._headers);
8+
this.headers = new FastBootHeaders(response.getHeaders());
89
this.statusCode = 200;
910
}
1011
}

packages/fastboot/test/fastboot-dependencies-test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ const FastBoot = require('./../src/index');
66

77
describe('FastBoot with dependencies', function() {
88
it('it works with dependencies', function() {
9-
var fastboot = new FastBoot({
9+
const fastboot = new FastBoot({
1010
distPath: fixture('app-with-dependencies'),
1111
});
12+
const response = {
13+
getHeaders() {},
14+
};
1215

1316
return fastboot
14-
.visit('/')
17+
.visit('/', { response })
1518
.then(r => r.html())
1619
.then(html => {
1720
expect(html).to.match(/https:\/\/emberjs.com/);

packages/fastboot/test/fastboot-info-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ describe('FastBootInfo', function() {
2323
};
2424

2525
beforeEach(function() {
26-
response = {};
26+
response = {
27+
getHeaders() {},
28+
};
2729
request = {
2830
cookie: '',
2931
protocol: 'http',

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

packages/fastboot/test/fastboot-shoebox-test.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ const FastBoot = require('./../src/index');
66

77
describe('FastBootShoebox', function() {
88
it('can render the escaped shoebox HTML', function() {
9-
var fastboot = new FastBoot({
9+
const fastboot = new FastBoot({
1010
distPath: fixture('shoebox'),
1111
});
12+
const response = {
13+
getHeaders() {},
14+
};
1215

1316
return fastboot
14-
.visit('/')
17+
.visit('/', { response })
1518
.then(r => r.html())
1619
.then(html => {
1720
expect(html).to.match(
@@ -33,12 +36,16 @@ describe('FastBootShoebox', function() {
3336
});
3437

3538
it('can render the escaped shoebox HTML with shouldRender set to false', function() {
36-
var fastboot = new FastBoot({
39+
const fastboot = new FastBoot({
3740
distPath: fixture('shoebox'),
3841
});
42+
const response = {
43+
getHeaders() {},
44+
};
3945

4046
return fastboot
4147
.visit('/', {
48+
response,
4249
shouldRender: false,
4350
})
4451
.then(r => r.html())
@@ -62,12 +69,16 @@ describe('FastBootShoebox', function() {
6269
});
6370

6471
it('cannot render the escaped shoebox HTML when disableShoebox is set to true', function() {
65-
var fastboot = new FastBoot({
72+
const fastboot = new FastBoot({
6673
distPath: fixture('shoebox'),
6774
});
75+
const response = {
76+
getHeaders() {},
77+
};
6878

6979
return fastboot
7080
.visit('/', {
81+
response,
7182
disableShoebox: true,
7283
})
7384
.then(r => r.html())

0 commit comments

Comments
 (0)