-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
distribution/distribution
#4507Labels
area: instrumentationRelated to an instrumentation packageRelated to an instrumentation packagebugSomething isn't workingSomething isn't workinginstrumentation: otelhttp
Milestone
Description
Description
A clear and concise description of what the bug is.
In the latest release the call to request.Write() is setting the response headers to http.StatusOK
without checking if the WriteHeader is already called, this is causing issues when trying to set Status Codes and then trying to Write to the response.
Environment
- OS: darwin
- Architecture: arm64
- Go Version: go 1.22
otelhttp
version: v0.54.0
Steps To Reproduce
- Using this code ...
package main
import (
"fmt"
"gofr.dev/pkg/gofr"
)
func main() {
a := gofr.New()
a.GET("/hello", HelloHandler)
a.Run()
}
func HelloHandler(c *gofr.Context) (interface{}, error) {
name := c.Param("name")
if name == "" {
c.Log("Name came empty")
name = "World"
}
return fmt.Sprintf("Hello %s!", name), nil
}
- Run ...
go run main.go
curl --location 'localhost:8000/hello'
Expected behavior
The Write() call should check if the wroteHeader is true before calling WriteHeader()
Umang01-hash, ayoisaiah, ash2k and vamayufeisrijan-27
Metadata
Metadata
Assignees
Labels
area: instrumentationRelated to an instrumentation packageRelated to an instrumentation packagebugSomething isn't workingSomething isn't workinginstrumentation: otelhttp