Skip to content

Commit 719996f

Browse files
Fennygitbook-bot
authored andcommitted
GitBook: [master] 5 pages modified
1 parent 6324dd7 commit 719996f

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

context.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,40 @@ app.Get("/", func(c *fiber.Ctx) {
985985

986986
## Range
987987

988-
{% hint style="info" %}
989-
Coming soon! Feel free to create a PR!
990-
{% endhint %}
988+
An struct containg the type and a slice of ranges will be returned.
989+
990+
**Signature**
991+
992+
```go
993+
c.Range(int size)
994+
```
995+
996+
**Range struct**
997+
998+
```go
999+
type Range struct {
1000+
Type string
1001+
Ranges []struct {
1002+
Start int64
1003+
End int64
1004+
}
1005+
}
1006+
```
1007+
1008+
**Example**
1009+
1010+
```go
1011+
// Range: bytes=500-700, 700-900
1012+
app.Get("/", func(c *fiber.Ctx) {
1013+
b := c.Range(1000)
1014+
if b.Type == "bytes" {
1015+
for r := range r.Ranges {
1016+
fmt.Println(r)
1017+
// [500, 700]
1018+
}
1019+
}
1020+
})
1021+
```
9911022

9921023
## Redirect
9931024

0 commit comments

Comments
 (0)