Skip to content

Commit

Permalink
Merge pull request labstack#52 from git001/patch-1
Browse files Browse the repository at this point in the history
Add example for X-Request-ID
  • Loading branch information
lammel committed Dec 10, 2020
2 parents 10c581b + ecc1829 commit 9665f96
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions website/content/middleware/request-id.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@ DefaultRequestIDConfig = RequestIDConfig{
Generator: generator,
}
```

## Set ID

You can set the id from the requester with the `X-Request-ID`-Header

*request*
```
curl -H "X-Request-ID: 3" --compressed -v "http://localhost:1323/?my=param"
```

*Log*
```
{"time":"2017-11-13T20:26:28.6438003+01:00","id":"3","remote_ip":"::1","host":"localhost:1323","method":"GET","uri":"/?my=param","my":"param","status":200, "latency":0,"latency_human":"0s","bytes_in":0,"bytes_out":13}
```

0 comments on commit 9665f96

Please sign in to comment.