Ant-design-pro: post提交发现提交了两次

Created on 16 Jan 2018  ·  9Comments  ·  Source: ant-design/ant-design-pro

image

有谁知道会是什么情况,排查半天了。而且type 怎么一个是fetch 一个是json,Request Method一个是:OPTIONS 一个是post 怎么会多出一个OPTIONS

Most helpful comment

都加上就可以了

export default noProxy ? {
  'GET /api/*': 'https://your.server.com/',
  'POST /api/*': 'https://your.server.com/',
  'DEL /api/*': 'https://your.server.com/',
} : delay(proxy, 1000);

All 9 comments

你估计是跨域了吧 跨域会发起一次put 一次post

是跨域了。那应该是这个问题了吧。

最好用代理。改头部就会造成这个问题

按照文档上这样设置
// .roadhogrc.mock.js
export default {
'GET /api/(.*)': 'https://your.server.com/api/',
};
经常404,会是什么原因啊?

你从服务器看一下.是不是url拼接错了

没错啊,有时候请求成功。但有几个接口请求404,而且只要返回错误的结果好像都变成404错误。难道是我的代理设置有问题》?
image

pro对返回结果格式有要求?

问题找到了:
image 这个GET 时候POST的没用,POST的时候GET 没效果。有没有什么办法同时兼容?

都加上就可以了

export default noProxy ? {
  'GET /api/*': 'https://your.server.com/',
  'POST /api/*': 'https://your.server.com/',
  'DEL /api/*': 'https://your.server.com/',
} : delay(proxy, 1000);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhongjiewu picture zhongjiewu  ·  3Comments

yadongxie150 picture yadongxie150  ·  3Comments

skyFi picture skyFi  ·  3Comments

gaoqiang19514 picture gaoqiang19514  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments