GetObjectWithResp returns the response and the length of the object. It does not validate the checksum of the object in the response. Writes the response body to a writer if one is specified in the optional `GetObjectInput.Writer`. Otherwise, it discards the response body read. `io.Copy` is used i
(baseParams BaseParams, bck cmn.Bck, object string, options ...GetObjectInput)
| 361 | // |
| 362 | // `io.Copy` is used internally to copy response bytes from the request to the writer. |
| 363 | func GetObjectWithResp(baseParams BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (*http.Response, |
| 364 | int64, error) { |
| 365 | var ( |
| 366 | q url.Values |
| 367 | hdr http.Header |
| 368 | w = io.Discard |
| 369 | ) |
| 370 | if len(options) != 0 { |
| 371 | w, q, hdr = getObjectOptParams(options[0]) |
| 372 | } |
| 373 | q = bck.AddToQuery(q) |
| 374 | baseParams.Method = http.MethodGet |
| 375 | reqParams := AllocRp() |
| 376 | { |
| 377 | reqParams.BaseParams = baseParams |
| 378 | reqParams.Path = apc.URLPathObjects.Join(bck.Name, object) |
| 379 | reqParams.Query = q |
| 380 | reqParams.Header = hdr |
| 381 | } |
| 382 | resp, err := reqParams.doResp(w) |
| 383 | FreeRp(reqParams) |
| 384 | if err != nil { |
| 385 | return nil, 0, err |
| 386 | } |
| 387 | return resp.Response, resp.n, nil |
| 388 | } |
| 389 | |
| 390 | // PutObject creates an object from the body of the reader (`args.Reader`) and puts |
| 391 | // it in the specified bucket. |