Skip to content

Commit

Permalink
Merge pull request #138 from danielgtaylor/fiber-fix
Browse files Browse the repository at this point in the history
fix: allow fiber without StreamRequestBody, fixes #127
  • Loading branch information
danielgtaylor authored Oct 13, 2023
2 parents 9612405 + a343cf8 commit 65ba6ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adapters/humafiber/humafiber.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package humafiber

import (
"bytes"
"context"
"io"
"mime/multipart"
Expand Down Expand Up @@ -62,7 +63,11 @@ func (c *fiberCtx) EachHeader(cb func(name, value string)) {
}

func (c *fiberCtx) BodyReader() io.Reader {
return c.orig.Request().BodyStream()
if c.orig.App().Server().StreamRequestBody {
// Streaming is enabled, so send the reader.
return c.orig.Request().BodyStream()
}
return bytes.NewReader(c.orig.BodyRaw())
}

func (c *fiberCtx) GetMultipartForm() (*multipart.Form, error) {
Expand Down

0 comments on commit 65ba6ac

Please sign in to comment.