Skip to content

Fenny/requestid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Request ID

Release Discord Test Security Linter

Adds an indentifier to the response using the X-Request-ID header

Install

go get -u github.com/gofiber/fiber
go get -u github.com/gofiber/requestid

Signature

requestid.New(config ...requestid.Config) func(*fiber.Ctx)

Config

Property Type Description Default
Skip func(*fiber.Ctx) bool A function to skip the middleware nil
Generator func() string A function to generate an ID.e return uuid.New().String()

Example

package main

import (
  "github.com/gofiber/fiber"
  "github.com/gofiber/requestid"
)

func main() {
  app := fiber.New()
  
  app.Use(requestid.New())
  
  app.Get("/", func(c *fiber.Ctx) {
    c.Send(requestid.Get(c))
  })

  app.Listen(3000)
}

Test

curl -I http://localhost:3000

About

🧬 Request ID middleware for Fiber

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Go 100.0%