Skip to content

Commit a0ea288

Browse files
authored
Check reader if it's nil before reading
1 parent 80cd679 commit a0ea288

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ func (c *Context) GetHeader(key string) string {
871871

872872
// GetRawData returns stream data.
873873
func (c *Context) GetRawData() ([]byte, error) {
874+
if c.Request.Body == nil {
875+
return nil, errors.New("cannot read nil body")
876+
}
874877
return io.ReadAll(c.Request.Body)
875878
}
876879

0 commit comments

Comments
 (0)