| 1 | // Copyright The OpenTelemetry Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package confighttp // import "go.opentelemetry.io/collector/config/confighttp" |
| 5 | |
| 6 | import "io" |
| 7 | |
| 8 | // compressReadCloser couples the original compressed reader |
| 9 | // and the compression reader to ensure that the original body |
| 10 | // is correctly closed to ensure resources are freed. |
| 11 | type compressReadCloser struct { |
| 12 | io.Reader |
| 13 | orig io.ReadCloser |
| 14 | } |
| 15 | |
| 16 | var ( |
| 17 | _ io.Reader = (*compressReadCloser)(nil) |
| 18 | _ io.Closer = (*compressReadCloser)(nil) |
| 19 | ) |
| 20 | |
| 21 | func (crc *compressReadCloser) Close() error { |
| 22 | return crc.orig.Close() |
| 23 | } |