Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(request_overrider): Set
IncomingMessage.client
for parity with…
… real requests `ClientMessage.socket` is an instance of our `socket` class. As that class’ constructor sets `authorized` to `true` on `https` requests, the code here that sets `response.socket.authorized` is pointless. `ClientMessage.client` was deprecated in iojs 2.2 and per request/request#1615 but is still aliased: https://github.com/nodejs/node/blob/2e613a9c301165d121b19b86e382860323abc22f/lib/_http_incoming.js#L67 The old code, which sets `response.client.authorized`, is being replaced with new code which aliases `response.client`. This ensures that `response.client` and `response.socket` point to the same thing, which provides parity with a non-overridden request. This may help with compatibility with libraries which depend on that undocumented property, such as some very old versions of `request`. This also ensures that `response.client.authorized` remains set, without needing to set it directly. This is being changed now to remove two bits of unreachable code in the conditional.
- Loading branch information