NodeJS,自定义Content-Type给出空的主体
我在使用“application / vnd.api + json”作为NodeJS express app中的内容types时遇到了麻烦。
我的应用包含:
const app = express(); app.use(bodyParser.json({ type: 'application/vnd.api+json' })); app.use(bodyParser.urlencoded({ extended: true }));
发送标题为“Content-Type:application / vnd.api + json”的请求和一些json会产生一个空的req.body和undefined req.text。 通过“ Content-Type:application / json”发送相同的请求可以正常工作。
也试着用app.use(bodyParser.json({ type: 'application/*+json' }));
我错过了什么?
- Express&Socket.io – 最佳实践
- Node.js – 页面超时 – 发送后无法设置标题
- Angularjs不使用Facebookauthentication策略拦截nodejs服务器提供的令牌
- 我怎样才能提供inputstream到node.js /快递'发送,或获得其原始输出stream?
- MongooseJS使用find来查找参考
- NodeJS :: TypeError:无法读取未定义的属性'first_name'
- 确保快速应用程序在每个摩卡testing之前运行
- Express js Mongoose替代MySQL%通配符
- Nodejs + Express – 不能调用未定义的方法“json”