mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 05:12:49 +00:00
use getString in Range(#312)
* Transform string in Range without allocation
This commit is contained in:
parent
101e1cce98
commit
260f3b3410
2
ctx.go
2
ctx.go
@ -603,7 +603,7 @@ func (ctx *Ctx) Query(key string) (value string) {
|
||||
|
||||
// Range returns a struct containing the type and a slice of ranges.
|
||||
func (ctx *Ctx) Range(size int) (rangeData Range, err error) {
|
||||
rangeStr := string(ctx.Fasthttp.Request.Header.Peek(HeaderRange))
|
||||
rangeStr := getString(ctx.Fasthttp.Request.Header.Peek(HeaderRange))
|
||||
if rangeStr == "" || !strings.Contains(rangeStr, "=") {
|
||||
return rangeData, fmt.Errorf("malformed range header string")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user