Comments (4)
你好,能否提供一个简单的demo?
from webapiclient.
我大致理解你是重写了AuthorizationHandler的IsUnauthorizedAsync,来覆盖HttpClient的授权状态,当前你遇到的问题是需要读取两次Body?
from webapiclient.
是的
from webapiclient.
这种设计意味着想要获取{Status: 401}
必须要读取流,若考虑json中成员随机分布,Status可能出现在json的尾端,客户端由于重读的机制,性能随着报文的增大而降低,参考以下考量
- 1、如果你的应用是性能尚可的Client角色,且返回的报文不会太长,则无需过于担心二次反序列化的成本
- 2、如果你的应用同时也充当Server角色,即作为一个中间应用存在;首先考虑与服务端协商修改这种设计;若服务端无法修改这种设计,则考虑替换流以便其可以被重读,这样做的用处是有限的,【堆服务器配置可能收益更明显】。
from webapiclient.
Related Issues (20)
- 是否考虑支持接口转发的功能 HOT 5
- .net 7.0 Console程序怎么使用该组件? HOT 2
- .net 7.0的Console程序提示不支持将ContentType为 text/html 的内容转换为对象 HOT 3
- 生成上传文件代理时,找不到FileParameter参数。
- 参数为实体类时是否有Attribute可用于自定义字段名 HOT 4
- TimeOut action属性和Param属性 设置之后都不起作用 无论设置多少都是60秒超时 HOT 2
- WriteLog方法BUG。 HOT 2
- 如何处理超时异常 HOT 2
- 请问 HttpApiClient.Create<T>() 还支持吗? HOT 1
- 请求执行时出现SocketException,是否考虑将HttpContext也抛出
- 支持添加自定义请求头吗? HOT 5
- HttpRequestException.StatusCode 错误 HOT 3
- CancellationTokenTypeAttribute类变量用错了
- 如何在ApiReturnAttribute进行重发? HOT 2
- 偶尔抛出异常,原因不明,抛出异常的位置:JsonNetReturnAttribute; System.ObjectDisposedException: Cannot access a disposed object. HOT 1
- 调用的地方比较多,有办法在LoggingFilter中获取到调用的信息 HOT 1
- 使用时报了400的错误。我不太确定我哪一步出现问题 HOT 4
- 下载路径是QT6版本的,但是实际压缩包是QT5
- IApiFilter丢失AsyncLocal值 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webapiclient.