ecodeclub / ekit

支持泛型的工具库
https://doc.meoying.com/
Apache License 2.0
383 stars 164 forks source link

httpx: Request 和 Response 初步设计 #236

Closed flycash closed 11 months ago

flycash commented 11 months ago

在使用原生的 http 包的时候,充斥着大量的错误处理。这里我将整个过程简化了,只有在发起最终调用的时候,才会返回 error。

所谓的最终调用,就是指真正尝试解析 response 的时候,才会返回 error。在这之前,可以保持丝滑的链式调用。

codecov[bot] commented 11 months ago

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (14dba09) 95.77% compared to head (1932a13) 95.64%.

Files Patch % Lines
net/httpx/response.go 50.00% 2 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #236 +/- ## ========================================== - Coverage 95.77% 95.64% -0.14% ========================================== Files 62 65 +3 Lines 3265 3328 +63 ========================================== + Hits 3127 3183 +56 - Misses 106 112 +6 - Partials 32 33 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.