1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 19:53:19 +00:00

Fix - Etag README.md (#1584)

* Fix - Etag README.md

* Fix - Etag README.md
This commit is contained in:
RW 2021-10-19 11:36:16 +02:00 committed by GitHub
parent e6feb36827
commit ff38081eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ ETag middleware for [Fiber](https://github.com/gofiber/fiber) that lets caches b
- [Signatures](#signatures)
- [Examples](#examples)
- [Default Config](#default-config)
- [Default Config](#default-config-1)
- [Custom Config](#custom-config)
- [Config](#config)
- [Default Config](#default-config-2)
@ -21,7 +21,7 @@ func New(config ...Config) fiber.Handler
## Examples
First import the middleware from Fiber,
Import the middleware package that is part of the Fiber web framework
```go
import (
@ -30,7 +30,7 @@ import (
)
```
Then create a Fiber app with `app := fiber.New()`.
After you initiate your Fiber app, you can use the following possibilities:
### Default Config
@ -43,12 +43,14 @@ app.Get("/", func(c *fiber.Ctx) error {
})
```
### Default Config
### Custom Config
```go
app.Use(etag.New())
app.Use(etag.New(etag.Config{
Weak: true,
}))
// Get / receives Etag: "13-1831710635" in response header
// Get / receives Etag: "W/"13-1831710635" in response header
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})