Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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
The npm package merge-headers receives a total of 313 weekly downloads. As such, merge-headers popularity was classified as not popular.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.