We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
`const flyio = require("flyio"); //添加请求拦截器 flyio.interceptors.request.use((request) => { request.baseURL = baseURL; //给所有请求添加自定义header request.headers["X-Tag"] = "flyio"; request.url = request.url + "?beid=3";
//打印出请求体 console.log(request.body); //终止请求 return request; }); //添加响应拦截器,响应拦截器会在then/catch处理之前执行 flyio.interceptors.response.use( (response) => { Toast(response.data.status) if(response.data.status == 1){ return response.data.result } }, (err) => { console.log(err); //发生网络错误后会走到这里 //return Promise.resolve("ssss") } )
// get export const _get = (req) => { return flyio.get(req.url,req.data) }
// post export const _post = (req) => { return flyio.post(req.url, req.data) } `
The text was updated successfully, but these errors were encountered:
你的请求是不是夸域的?对于非简单的跨域请求,浏览器都会先发起一次预检请求(options)
From gitme Android
Sorry, something went wrong.
No branches or pull requests
`const flyio = require("flyio");
//添加请求拦截器
flyio.interceptors.request.use((request) => {
request.baseURL = baseURL;
//给所有请求添加自定义header
request.headers["X-Tag"] = "flyio";
request.url = request.url + "?beid=3";
//打印出请求体
console.log(request.body);
//终止请求
return request;
});
//添加响应拦截器,响应拦截器会在then/catch处理之前执行
flyio.interceptors.response.use( (response) => {
Toast(response.data.status)
if(response.data.status == 1){
return response.data.result
}
}, (err) => {
console.log(err);
//发生网络错误后会走到这里
//return Promise.resolve("ssss")
}
)
// get
export const _get = (req) => {
return flyio.get(req.url,req.data)
}
// post
export const _post = (req) => {
return flyio.post(req.url, req.data)
}
`
The text was updated successfully, but these errors were encountered: