-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎么使用 application/json 类型的解析器 #294
Comments
mocker-api/example/webpack/mocker/user.js Lines 2 to 19 in 8c3ec69
我测试示例,可以获取 body 参数,不清楚你是怎么请求数据的 |
@chakson 不太清楚你怎么使用的,目前我测试没有问题,请看上图 |
测试的就这个示例。 |
在 express 中加入 body-parser,这样 Content-Type: application/json 就可以解析了
你这个项目是不是有 application/json 相关的配置,这几个配置看不懂怎么用 |
mocker-api/packages/core/src/index.ts Lines 215 to 233 in c1bd0d5
@chakson 是支持配置的默认不需要的样子 在 webpack 示例中默认没有配置,支持 json 解析 mocker-api/example/webpack/webpack.config.js Lines 16 to 21 in c1bd0d5
|
使用 Content-Type: application/x-www-form-urlencoded 可以正常返回数据,
使用 Content-Type: application/json 无法正常解析 req.body 的请求数据,
请问这个要怎么配置
The text was updated successfully, but these errors were encountered: