Closed ochanism closed 2 years ago
I think that it is reasonably @chripo , what do you think?
i like the idea, it's a great feature.
but it need's more work, because the Range header should be applied to the specific request not generally (what SetHeader
does).
a way to go...
the c.req func
supports an intercept function as argument which could be used to set the Range header for a specific call.
wrapped in a new ReadStreamRange or ReadSteamChunk
func would provide the functionality.
patches and improvements always welcome.
I tried to call ReadStream with header SetHeader("Range", "bytes=10-100"), but it failed because ReadStream only accepts 200 http response code. The response code of range bytes request is 206 (Partial Content).
https://github.com/studio-b12/gowebdav/blob/3cd755d6c4753083fdfcd45b71e88100bf8f2057/client.go#L332
I think the above code needs to be revised as follows:
if rs.StatusCode == 200 || rs.StatusCode == 206 {