当我向某个端点发送删除请求时,例如从终端发送
httpie
http删除http:// localhost:8181 / admin / applications / uspecs
我得到了一个有效的行为,如{success:true}作为响应主体.
但是,当我这样做
fetch ( 'http://localhost:8181/admin/applications/uspecs',{ method: 'DELETE',} ) .then( res => doSomethingWithResponse()) .catch( err => cosole.error(err))
在javascript代码中,然后我得到了一个
Fetch API cannot load http://localhost:8181/admin/applications/uspecs. Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.