When adding or changing public request/response methods, protect existing contracts and behavior instead of introducing silent breaking changes. Concretely:
cookie.expires must stay a Date, not sometimes accept 0/number; res.status must keep its documented numeric contract) and run any real behavior change through a deprecation cycle rather than changing it outright.res.links(arr) must not delete properties off the caller’s array elements) — copy/derive values instead.etag) must not override an option the caller explicitly passed to the method call.res.sendStatus should delegate to res.send/res.type so headers, content-type, and chaining stay consistent, rather than calling res.end() directly and losing that behavior:res.sendStatus = function sendStatus(statusCode) {
var body = http.STATUS_CODES[statusCode] || String(statusCode)
this.statusCode = statusCode
this.type('txt')
return this.send(body)
}
</invoke>