diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go index b013af9d4d4..f08fbd5c5f7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go @@ -267,8 +267,8 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...fun return c, nil } -// WithHTTPCollectorRespondingPlainText makes the HTTPCollector to return a -// plaintext, instead of protobuf, response. +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { return func(s *HTTPCollector) { s.plainTextResponse = true @@ -398,7 +398,7 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { if c.plainTextResponse { w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.WriteHeader(http.StatusOK) - _, _ = io.WriteString(w, "OK") + _, _ = w.Write([]byte("OK")) return } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go index 1805b994422..6398f8ba5ba 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go @@ -267,8 +267,8 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...fun return c, nil } -// WithHTTPCollectorRespondingPlainText makes the HTTPCollector to return a -// plaintext, instead of protobuf, response. +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { return func(s *HTTPCollector) { s.plainTextResponse = true @@ -398,7 +398,7 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { if c.plainTextResponse { w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.WriteHeader(http.StatusOK) - _, _ = io.WriteString(w, "OK") + _, _ = w.Write([]byte("OK")) return } diff --git a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl index cc1a7e0e47e..fba237e68fc 100644 --- a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl @@ -267,8 +267,8 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...fun return c, nil } -// WithHTTPCollectorRespondingPlainText makes the HTTPCollector to return a -// plaintext, instead of protobuf, response. +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { return func(s *HTTPCollector) { s.plainTextResponse = true @@ -398,7 +398,7 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { if c.plainTextResponse { w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.WriteHeader(http.StatusOK) - _, _ = io.WriteString(w, "OK") + _, _ = w.Write([]byte("OK")) return }