eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Home Page:https://eggjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用curl转发请求的时候,会404异常

DricHao opened this issue · comments

commented

const data = await ctx.curl(app.config.baseUri + href, { method: ctx.method, dataType: 'json', headers: ctx.header, }) console.log('成功'); ctx.body = 'good';
只要把ctx.body放在curl请求之前就会请求到'good',放在它之后就是请求404,这是怎么回事?cur请求是能够正常请求到数据的

看看是不是中间件的执行顺序问题

提供下最小可复现仓库

解决了吗

npm init egg --type=simple 初始化个最小可复现仓库,然后提交到你的 GitHub 吧。

先关了,有可复现的最小仓库再重新打开