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

fix: rm superfluous header on actor example

Open sicoyle opened this issue 2 years ago • 6 comments

Similar to: https://github.com/dapr/go-sdk/issues/218

There is a superfluous header call show in the actors example:

al.placement type=log ver=edge
DEBU[0004] Executing reminder for actor testActorType||ActorImplID123456||testReminderName  app_id=actor-serving instance=Samanthas-MacBook-Pro-2.local scope=dapr.runtime.actor type=log ver=edge
== APP == 2023/09/08 14:15:37 failed to unmarshal reminder param, err: illegal base64 data at input byte 4 
== APP == 2023/09/08 14:15:37 http: superfluous response.WriteHeader call from github.com/dapr/go-sdk/service/http.(*Server).registerBaseHandler.func6 (topic.go:199)

With the removal of the line in this PR, the superflous header is removed:

DEBU[0002] Executing reminder for actor testActorType||ActorImplID123456||testReminderName  app_id=actor-serving instance=Samanthas-MacBook-Pro-2.local scope=dapr.runtime.actor type=log ver=edge
== APP == 2023/09/08 14:16:24 failed to unmarshal reminder param, err: illegal base64 data at input byte 4 

sicoyle avatar Sep 08 '23 19:09 sicoyle

Codecov Report

Patch coverage: 66.66% and project coverage change: -0.91% :warning:

Comparison is base (4afb831) 70.00% compared to head (0c6cce8) 69.09%. Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #444      +/-   ##
==========================================
- Coverage   70.00%   69.09%   -0.91%     
==========================================
  Files          33       34       +1     
  Lines        2667     2741      +74     
==========================================
+ Hits         1867     1894      +27     
- Misses        698      737      +39     
- Partials      102      110       +8     
Files Changed Coverage Δ
client/client.go 70.24% <33.33%> (+0.50%) :arrow_up:
service/http/topic.go 87.79% <83.33%> (-1.58%) :arrow_down:

... and 3 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 08 '23 19:09 codecov[bot]

We still need the write header line that was removed, because it accounts for a situation where there's no error. What needs to be done is to add a return statement in all other WriteHeader code blocks before the StatusOk one. There are other places in the code with the same issue, so it'd be great to add those return statements there too.

yaron2 avatar Sep 08 '23 19:09 yaron2

ping @sicoyle

yaron2 avatar Sep 15 '23 16:09 yaron2

pong @yaron2 😄

sicoyle avatar Sep 15 '23 20:09 sicoyle

Could we add a test for it?

daixiang0 avatar Dec 06 '23 02:12 daixiang0

Hi @daixiang0 @sicoyle , can this be merged asap please?

GowthamHN avatar Aug 19 '24 16:08 GowthamHN