File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,9 @@ func (o *Option) downloadWithContext(
140
140
}
141
141
142
142
// add range header
143
- fmt .Printf (fmt .Sprintf ("bytes=%d-%d\n " , o .Units [i ].RangeStart , o .Units [i ].RangeEnd ))
144
- req .Header .Set ("Range" , fmt .Sprintf ("bytes=%d-%d" , o .Units [i ].RangeStart , o .Units [i ].RangeEnd ))
143
+ byteRange := fmt .Sprintf ("bytes=%d-%d" , o .Units [i ].RangeStart , o .Units [i ].RangeEnd )
144
+ fmt .Println (byteRange )
145
+ req .Header .Set ("Range" , byteRange )
145
146
146
147
client := http .DefaultClient
147
148
resp , err := client .Do (req )
@@ -154,7 +155,7 @@ func (o *Option) downloadWithContext(
154
155
select {
155
156
case <- ctx .Done ():
156
157
fmt .Printf ("Done: %v %+v\n " , i , o .Units [i ])
157
- return nil
158
+ return fmt . Errorf ( "Error: %v" , err )
158
159
default :
159
160
fmt .Println ("default:" , i , o .Units [i ])
160
161
}
You can’t perform that action at this time.
0 commit comments