Skip to content

Commit

Permalink
no need to create a new object
Browse files Browse the repository at this point in the history
  • Loading branch information
nigrosimone authored Nov 16, 2024
1 parent e8bb956 commit 6ff51e6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,19 @@ module.exports = class Request extends Readable {
}

accepts(...types) {
const accept = accepts({ headers: this.headers });
return accept.types(...types);
return accepts(this).types(...types);
}

acceptsCharsets(...charsets) {
return accepts({ headers: this.headers }).charsets(...charsets);
return accepts(this).charsets(...charsets);
}

acceptsEncodings(...encodings) {
return accepts({ headers: this.headers }).encodings(...encodings);
return accepts(this).encodings(...encodings);
}

acceptsLanguages(...languages) {
return accepts({ headers: this.headers }).languages(...languages);
return accepts(this).languages(...languages);
}

is(type) {
Expand Down

0 comments on commit 6ff51e6

Please sign in to comment.