go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

http: superfluous response.WriteHeader call in topic.go:200

Open GowthamHN opened this issue 1 year ago • 0 comments

Describe the bug Superfluous writeHeader calls are made in the registerBaseHandler function of topic.go file.

http: superfluous response.WriteHeader call from github.com/dapr/go-sdk/service/http.(*Server).registerBaseHandler.func6 (topic.go:200)

To Reproduce Here's the sample code to reproduce the behavior.

func ActorFactory() actor.ServerContext {
	client, err := dapr.NewClient()
	if err != nil {
		panic(err)
	}
	agent := &BackupStatusMonitoringAgent{
		DaprClient:   client,
		HttpClient:   &http.Client{},
		DaprHttpPort: 3500,
	}

	return agent
}

var appPort = 9001
func main() {
	s := daprd.NewService(fmt.Sprintf(":%v", appPort))
	s.RegisterActorImplFactoryContext(server.ActorFactory)
	if err := s.Start(); err != nil && err != http.ErrServerClosed {
		log.Fatalf("error listenning: %v", err)
	}
}

Expected behavior The status code headers must be mutually exclusive and not superfluous

GowthamHN avatar Aug 19 '24 17:08 GowthamHN