Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
merge-headers
Advanced tools
Easily merge HTTP headers
merge-headers
is a utility function that merges all your headers (plain objects, Headers instances or in Arrays format) and gives you the possibility to remove specific headers without too much headache.
import mergeHeaders from 'merge-headers';
const oldHeaders = new Headers({
'Content-Type': 'text/xml',
'Authorization': 'basic'
});
// Remove `Authorization` header without altering `oldHeaders`
const newHeaders = mergeHeaders(oldHeaders, {
'Authorization': undefined
});
console.log(newHeaders.has('Authorization'));
// => false
// Or just merge two headers object
const headers = mergeHeaders(oldHeaders, {
'rainbow': 'rainbow'
});
console.log(headers.has('Autorization'));
// => true
console.log(headers.has('rainbow'));
// => true
The sources
are the same as what the Headers
constructor can take.
A TypeError
will be thrown if sources
contains something else than an object.
Returns a Headers
object.
This is mostly for convenience. It is much easier to do mergeHeaders()
instead of deleting them one by one, thus mutating your headers instance. This way you create a new one with the exact headers you want.
FAQs
Easily merge HTTP headers
We found that merge-headers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.