Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这里不建议将Uid直接放在Header中,在conn.asyncreport.ReportStatus的异步任务回传状态时,与任务的uid冲突,导致回传状态的uid为空。
覆盖步骤:
1、在NewRequest时,使用AddHeader设置uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/transport/request.go#L52
2、在ReportStatus时,使用AddParam设置任务uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/conn/asyncreport/asyncreport.go#L41
3、GetBody()获取请求体时,会将Header中的uid覆盖掉Param的uid。
https://github.com/chaosblade-io/chaosblade-box-agent/blob/main/pkg/http/http.go#L93C29-L93C46
4、最终导致第二步设置的uid丢失