diff --git a/context.go b/context.go index c41c71ec..08f3a2df 100644 --- a/context.go +++ b/context.go @@ -871,6 +871,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) }