Dva: 在service中使用'post','delete'和'put'每次都发送两次HTTP请求

Created on 16 Nov 2016  ·  6Comments  ·  Source: dvajs/dva

_076
第一次发送的请求:

OPTIONS /admin/users HTTP/1.1

第二次:

DELETE /admin/users HTTP/1.1
Payload: {"uid":"10000000005"}

请问这是怎么回事啊?明明只调用了一次fetch方法.

question

Most helpful comment

这是跨域的问题. 和dva没有关系

All 6 comments

debugger 看下是否执行了两次。

这是跨域的问题. 和dva没有关系

是的,跨域时,会先发送一次OPTIONS请求,再发DELETE/PUT等;

在 2016年11月16日,下午9:52,lincenying [email protected] 写道:

这是跨域的问题. 和dva没有关系


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/dvajs/dva/issues/280#issuecomment-260951394, or mute the thread https://github.com/notifications/unsubscribe-auth/ACv7UvGKNrvcahpgePKHygwfNkM-NPlKks5q-wqMgaJpZM4KzrnW.

@yuzhouisme 谢谢了,我用dora-plugin-proxy代理了一下,还有没有其它的解决办法?

只要是ajax请求跨域, 就没有办法, 跨域遇到复杂请求, 都会先发option去请求是否有权限跨域
这个没什么影响, 实在不想看到, 只能同源服务器去做代理

hi,你好,我也遇到这个问题了,怎么解决的呢?还请不吝赐教

Was this page helpful?
0 / 5 - 0 ratings

Related issues

huyawei picture huyawei  ·  3Comments

zouyan532 picture zouyan532  ·  3Comments

yaeSakuras picture yaeSakuras  ·  3Comments

MiaoXingGua picture MiaoXingGua  ·  3Comments

ljjsimon picture ljjsimon  ·  3Comments