Busboy "missing content-type" error
I am trying to use Busboy with Solidstart API, So I have POST api where form sends file, but I think busboy reads headers in a way that is not valid for my headers,
const bb = busboy({headers: request.request.headers })
request.request.headers return headerList where busboy tries to read content-type but it fails because its within the _HeadersList {
cookies: null,
[Symbol(headers map)]: Map(20) {--------- content-type is Somewhere here in the map ---------}
How can I modify thing in my code to make busboy able to handle things properly
2 Replies
Based on the README I'd try:
APIEvent
extends FetchEvent
; event.nativeEvent
is an HTTPEvent
which is actually an H3Event
Event Object - h3
Event object carries an incoming request and context.
GitHub
solid-start/packages/start/src/server/types.ts at 185ea8c6a73199b6f...
SolidStart, the Solid app framework. Contribute to solidjs/solid-start development by creating an account on GitHub.
GitHub
GitHub - mscdex/busboy: A streaming parser for HTML form data for n...
A streaming parser for HTML form data for node.js. Contribute to mscdex/busboy development by creating an account on GitHub.
GitHub
vinxi/packages/vinxi/runtime/http-types.d.ts at e9f6a235c67bca6a904...
The Full Stack JavaScript SDK. Contribute to nksaraf/vinxi development by creating an account on GitHub.
It works I do get the headers as object but busboy has this type of check which should be pass it without error but it still throws the error
module.exports = (cfg) => {
if (typeof cfg !== 'object' cfg === null)
cfg = {};
if (typeof cfg.headers !== 'object'
cfg.headers === null
|| typeof cfg.headers['content-type'] !== 'string') {
throw new Error('Missing Content-Type');
}
return getInstance(cfg);
};
@peerreynders Hey thanks for help I updated npm cleared caches and it works.