fix: HTTP fetch crash when modified request extra via extension (#832)

This commit is contained in:
Levi authored and GitHub committed 2024-12-08 12:07:08 +08:00
1 parent 35a3625b11
commit f4876c8a0e
2 files changed
+20 -11

No files matched your search

+6 -3
View File
@@ -162,9 +162,6 @@ func (f *Fetcher) Resolve(req *base.Request) error {
func (f *Fetcher) Create(opts *base.Options) error {
f.meta.Opts = opts
if err := base.ParseReqExtra[fhttp.ReqExtra](f.meta.Req); err != nil {
return err
}
if err := base.ParseOptsExtra[fhttp.OptsExtra](f.meta.Opts); err != nil {
return err
}
@@ -198,6 +195,12 @@ func (f *Fetcher) Start() (err error) {
if err != nil {
return err
}
// Avoid request extra modified by extension
if err = base.ParseReqExtra[fhttp.ReqExtra](f.meta.Req); err != nil {
return err
}
if f.chunks == nil {
f.chunks = f.splitChunk()
}