Skip to content

Commit

Permalink
update serialization error name
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Feb 29, 2024
1 parent 86444c8 commit 4feb763
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions otlp/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,20 @@ func WriteOtlpHttpResponse(w http.ResponseWriter, r *http.Request, statusCode in

contentType := r.Header.Get("Content-Type")
var body []byte
var err error
var serializationError error
switch contentType {
case "application/json":
body, err = protojson.Marshal(m)
body, serializationError = protojson.Marshal(m)
case "application/x-protobuf", "application/protobuf":
body, err = proto.Marshal(m)
body, serializationError = proto.Marshal(m)
default:
// If the content type is not supported, return a 415 Unsupported Media Type via text/plain
body = []byte(ErrInvalidContentType.Message)
contentType = "text/plain"
statusCode = ErrInvalidContentType.HTTPStatusCode
}
if err != nil {
return err
if serializationError != nil {
return serializationError
}

// At this point we're committed
Expand Down

0 comments on commit 4feb763

Please sign in to comment.