Comments (7)
It's not a case-sensitivity issue with content-type. The problem seems to be that the cfg.headers['content-type'] statement returns undefined because the headers in the routing endpoint's request are not a plain map.
This is because busboy is not getting the value in the form of headers.get('content-type'), but using index brackets. To make it more convenient, it seems like a good idea to ask busboy authors to use headers.get.
In a nutshell, try this:
const simpleHeaders = {};
for (const key of request.headers.keys()) {
simpleHeaders[key] = request.headers.get(key);
}
const busboy = Busboy({ headers: simpleHeaders });
or
const busboy = Busboy({ headers: Object.fromEntries(request.headers) });
from busboy.
Have you checked the contents of event.headers
to know what is the proper casing? It must be something other than the two you're attempting to access.
from busboy.
@mscdex I logged it. It is lower case
from busboy.
headers: {
...event.headers,
"Content-Type":
event.headers["Content-Type"] || event.headers["content-type"],
}```
I tried updating the string here to have to exactly same case the error is mentioning.
from busboy.
I don't know what to tell you then as event.headers
seems to already have only lowercased header names. The only way you can get the "Missing Content-Type" error is if the headers
object you pass to busboy
is a non-object, null
, or if headers['content-type']
is not a string.
Just to double check, what does typeof event.headers['content-type']
show?
from busboy.
It logs back as string
I really feel there might be something on Busboy's end that is messing this up. I think people still have these problems with lamda functions - saw that when I was going through all the issues here
from busboy.
Well, you'll need to dig into the code and troubleshoot it yourself then because I have no explanation as to why you're receiving that particular error in this case.
from busboy.
Related Issues (20)
- multipart/form-data windows-1251 HOT 4
- Content-Transfer-Encoding for POST request on multipart message not working HOT 2
- ERR_CONNECTION_ABORTED with long file uploads HOT 6
- licenses in package.json is deprecated HOT 2
- Bug on UTF-8 filenames HOT 2
- Problem on utf8 filename HOT 5
- [email protected] SyntaxError: Unexpected token { HOT 1
- Busboy does not recognize `image/jpeg` without `filename` as files HOT 1
- Extracting Filename when Empty String fails
- need to get raw headers HOT 1
- busboy seems to read ahead too fast for many small (< 16KiB) files HOT 5
- Events order when parsing file HOT 6
- Typings for field name HOT 1
- File event has not been triggered with nuxt 3 HOT 5
- Unexpected end of form HOT 2
- File size unavalaible HOT 1
- Unusable uploaded files. HOT 1
- Unusable uploaded files (with the right module) HOT 1
- Error: Unexpected end of form HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from busboy.