ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
852 stars 160 forks source link

Removes call to deprecated OutgoingMessage.prototype._headers #859

Closed SergeAstapov closed 2 years ago

SergeAstapov commented 2 years ago

Method response.getHeaders() was introduced in Node.js v7.7 Node.js PR https://github.com/nodejs/node/pull/11562

Property response._headers deprecated in Node.js v12.0 Node.js PR https://github.com/nodejs/node/pull/24167

Deprecation documentation https://nodejs.org/docs/latest-v12.x/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames

This fixes an issue I see in Node.js v14:

(node:40723) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
    at new FastbootResponse (/Users/.../node_modules/fastboot/src/fastboot-response.js:7:49)
    at new FastBootInfo (/Users/.../node_modules/fastboot/src/fastboot-info.js:27:21)
    at EmberApp.visit (/Users/.../node_modules/fastboot/src/ember-app.js:330:24)
    at FastBoot.visit (/Users/.../node_modules/fastboot/src/index.js:79:22)
    at /Users/.../node_modules/fastboot-express-middleware/src/index.js:31:14
    at /Users/.../node_modules/ember-cli-fastboot/index.js:342:11
    at Layer.handle [as handle_request] (/Users/.../node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/.../node_modules/express/lib/router/index.js:317:13)
    at /Users/.../node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/.../node_modules/express/lib/router/index.js:335:12)
    at next (/Users/.../node_modules/express/lib/router/index.js:275:10)
    at /Users/.../node_modules/ember-cli/lib/tasks/server/middleware/broccoli-watcher/index.js:54:11
    at watcher.then.errorHandler.buildError (/Users/.../node_modules/broccoli-middleware/lib/watcher-middleware.js:35:7)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
SergeAstapov commented 2 years ago

@rwjblue updated only two tests where we explicitly used response._headers as this is now deprecated API which will be removed from Node.js itself and I believe we should stop using ourselves (although support it for the time being).