Repository navigation
Release v1.3.2
🐛 缺陷修复 / Bug fix: 修复网络请求耗时(duration)在响应尚未到达时即被错误计算的问题。
This release fixes an issue where network request duration was calculated prematurely, before the response had actually arrived.
本版本修复了 HTTP 拦截器在捕获请求体(body)阶段误将请求标记为已完成、导致耗时计算错误的问题,并补充了对应的单元测试。公共 API 不变。
This release fixes a bug where the HTTP interceptor mistakenly marked a request as complete (and computed its duration) during request-body capture, and adds unit tests for it. Public API unchanged.
修复 / Fixed:
- 网络请求耗时计算时机 / Network request duration timing
InspectorService.updateNetworkRequest现在仅在提供statusCode(即响应到达)时才设置responseTime与duration;仅更新请求体(body,例如 HTTP 拦截器在close()中捕获请求体)时保留原值,不再过早标记请求已完成InspectorService.updateNetworkRequestnow only setsresponseTimeanddurationwhenstatusCodeis provided (response arrival). Updating only the request body (e.g. HTTP interceptor capturing the body inclose()) keeps them unset, so requests are no longer prematurely marked complete- 修复后:先捕获请求体、后收到响应的请求,其
duration反映真实的响应耗时而非请求体捕获时刻 - After the fix: a request whose body is captured first and response arrives later reports
durationfor the real response time, not the body-capture moment
- 单元测试 / Unit tests
test/models_test.dart新增InspectorService.updateNetworkRequest responseTime测试组,覆盖:仅更新 body 不设置responseTime、提供statusCode设置、先 body 后响应的时序test/models_test.dartadds theInspectorService.updateNetworkRequest responseTimegroup covering: body-only update leavesresponseTimeunset,statusCodesets it, and the body-then-response sequence