need to get raw headers
I need to get the full raw headers from each field, as is, without any modification.
Motivation
You do strip out quite a bit, and leave many things behind.
headers that are not known to you gets discarded, headers meta ;key=value pair gets discarded too.
And some things even get modified as you apply to lowercase here and there.
I need to parse the headers on my own, so it would be good if you could send the headers as a 2D iterable array (as one header could appair twice)
// x-forwared-for: 192.168.0.1
// x-forwared-for: 192.168.0.2
headers = new Headers([
['x-forwared-for', '192.168.0.1'],
['x-forwared-for', '192.168.0.2']
])
headers.get('x-forwared-for') // 192.168.0.1, 192.168.0.2
Example
the arguments length is getting out of control cuz they are so many now. and i don't need all of them... An object would be better...
- busboy.on('field', (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) => {
+ busboy.on('field', (field) => {
console.log(`Field [${field.fieldname}]: value: ${field.val}`);
});
so that i could do:
busboy.on('field', (field) => {
console.assert(Array.isArray(field.headers))
Object.fromEntries(field.headers)
new Headers(field.headers)
})
An object would be better...
I take it you haven't upgraded to v1.x?