Skip to content
New issue

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

Requested事件接收和返回数据的问题 #13

Closed
yuanqinglin1 opened this issue Apr 29, 2019 · 9 comments
Closed

Requested事件接收和返回数据的问题 #13

yuanqinglin1 opened this issue Apr 29, 2019 · 9 comments

Comments

@yuanqinglin1
Copy link

1.Requested事件,请问如何获取请求api返回的数据?
2.Requested事件,请问如何对api返回的数据重新封装返回前端?

@beetlex-io
Copy link
Owner

@yuanqinglin1
暂没提供这样的事件,Requested事件是已经响应完成,主要用于日志和跟踪用。
能否说一下这样做的需求情况

@yuanqinglin1
Copy link
Author

yuanqinglin1 commented Apr 29, 2019 via email

@beetlex-io
Copy link
Owner

@yuanqinglin1
其实网关只负责网络流的处理,这种拆解分析消息体再拼装对性能的影响还是比较大的,
可以尝试了解一下RequestAgent类的ResponseBody方法,这个方法是负责http消息体转发。

@yuanqinglin1
Copy link
Author

yuanqinglin1 commented Apr 30, 2019 via email

@beetlex-io
Copy link
Owner

@yuanqinglin1
把流中的数据read to bytes后根据自己实际情况进行处理,然后把最终结果转成bytes写回到对应响应的流中。

@yuanqinglin1
Copy link
Author

yuanqinglin1 commented May 2, 2019 via email

@yuanqinglin1
Copy link
Author

yuanqinglin1 commented May 2, 2019 via email

@beetlex-io
Copy link
Owner

@yuanqinglin1
使用正则表达式来匹配

@yuanqinglin1
Copy link
Author

yuanqinglin1 commented May 3, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants