Skip to content

Commit

Permalink
chore(request): check reader if it's nil before reading (#3419)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahyao1024 authored Mar 11, 2024
1 parent 1b3c085 commit ab8042e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,9 @@ func (c *Context) GetHeader(key string) string {

// GetRawData returns stream data.
func (c *Context) GetRawData() ([]byte, error) {
if c.Request.Body == nil {
return nil, errors.New("cannot read nil body")
}
return io.ReadAll(c.Request.Body)
}

Expand Down

0 comments on commit ab8042e

Please sign in to comment.