Skip to content

Commit

Permalink
Add example for X-Request-ID
Browse files Browse the repository at this point in the history
Sometimes you want to set the request ID from the requester.
This is a example call how you can do this
  • Loading branch information
git001 committed Nov 13, 2017
1 parent 43a4ede commit ecc1829
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 ecc1829

Please sign in to comment.