Skip to content

Commit

Permalink
added check for nil required body
Browse files Browse the repository at this point in the history
  • Loading branch information
sumittokkar authored and sumittokkar committed Dec 25, 2020
1 parent 0eb7d66 commit 3ec6dc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion body.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
const InvalidRequestBodyError = "invalid request body"

func checkBody(requiredBody map[string]string, body io.ReadCloser) error {
if requiredBody == nil {
return nil
}

bytes, err := ioutil.ReadAll(body)
if err != nil {
return err
Expand All @@ -34,4 +38,4 @@ func checkBody(requiredBody map[string]string, body io.ReadCloser) error {
}

return nil
}
}

0 comments on commit 3ec6dc5

Please sign in to comment.