Skip to content

Commit

Permalink
feat(serializers): use properties to infer types Request and Response
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardolima committed Dec 9, 2024
1 parent 7d47964 commit b393732
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* eslint no-prototype-builtins: 0 */

const { EventEmitter } = require('node:events')
const { IncomingMessage, ServerResponse } = require('node:http')
const {
lsCacheSym,
levelValSym,
Expand Down Expand Up @@ -198,9 +197,9 @@ function write (_obj, msg, num) {
if (msg === undefined) {
msg = _obj.message
}
} else if (_obj instanceof IncomingMessage) {
} else if (_obj.method && _obj.headers && _obj.socket) {
obj = { [requestKey]: _obj }
} else if (_obj instanceof ServerResponse) {
} else if (typeof _obj.setHeader === 'function') {
obj = { [responseKey]: _obj }
} else {
obj = _obj
Expand Down

0 comments on commit b393732

Please sign in to comment.