Skip to content

Commit

Permalink
fix: decode empty body (#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybase authored Mar 17, 2022
1 parent 096e2b0 commit c550a88
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transport/http/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func DefaultRequestDecoder(r *http.Request, v interface{}) error {
if err != nil {
return errors.BadRequest("CODEC", err.Error())
}
if len(data) == 0 {
return nil
}
if err = codec.Unmarshal(data, v); err != nil {
return errors.BadRequest("CODEC", err.Error())
}
Expand Down

0 comments on commit c550a88

Please sign in to comment.