dapr / go-sdk

Dapr SDK for go
Apache License 2.0
446 stars 171 forks source link

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

Open GowthamHN opened 2 months ago

GowthamHN commented 2 months ago

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