【发布时间】:2020-06-12 14:08:23
【问题描述】:
我搜索并找不到正确的答案。 我似乎很无奈。但幸运的是,visua 代码帮助调试了代码,我在 index.js@hapi/subtext/lib 文件中找到了这一行
if (contentType.mime === 'multipart/form-data') {
if (options.multipart === false) {// Defaults to true
throw Boom.unsupportedMediaType ();
}
return await internals.multipart (req, options, source, contentType);
}
然后我在路由器选项中修复了 multipart = true:
{
payload: {
maxBytes: 1024 * 1024 * 100,
// timeout: false, // important
parse: true,
output: 'data',
allow: 'multipart / form-data',
multipart: true
}
}
它奏效了。感谢您的 visua 代码调试。我回信给可能会收到此错误的人。知道如何处理。
我使用 hapi 版本 19.0.3
【问题讨论】:
-
同样的问题。你解决了吗?
标签: hapijs