fastify / fastify/busboy

Need to get full header

Open
#127 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
139
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested

### 🚀 Feature Proposal

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)
```js
// 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...
```diff
- 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:
```js
busboy.on('field', (field) => {
console.assert(Array.isArray(field.headers))
Object.fromEntries(field.headers)
new Headers(field.headers)
})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.