第三方系统会像我前台的页面 post 一个请求,我没法处理,因为没有服务端,线上可以用 nginx 转发,但是开发环境只能自己配置 webpack-dev-server 了
1
lairdnote Dec 20, 2017
自己写一个 post 的接口 转 get 就 ok 了。。代理一下
|
3
loy6491 Dec 20, 2017 onProxyReq: function(reqProxy, req, res) {
reqProxy.method = 'GET'; } |
4
SourceMan Dec 20, 2017
如三楼所说,request 拦截器拦下了修改 method 再 return 回去发请求。
|
6
nuxt OP @SourceMan 具体怎么写
``` proxyTable: { '/withDrawals': { filter: function (path, req) { return req.method === 'POST' }, onProxyReq: function(reqProxy, req, res) { reqProxy.method = 'GET' return reqProxy }, target: '/withDrawals' }, '/rechargeMoney': { filter: function (path, req) { return req.method === 'POST' }, onProxyReq: function(reqProxy, req, res) { reqProxy.method = 'GET' return reqProxy }, target: '/rechargeMoney' } }, ``` |