Skip to content

Commit ecc1829

Browse files
authored
Add example for X-Request-ID
Sometimes you want to set the request ID from the requester. This is a example call how you can do this
1 parent 43a4ede commit ecc1829

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

website/content/middleware/request-id.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,17 @@ DefaultRequestIDConfig = RequestIDConfig{
4545
Generator: generator,
4646
}
4747
```
48+
49+
## Set ID
50+
51+
You can set the id from the requester with the `X-Request-ID`-Header
52+
53+
*request*
54+
```
55+
curl -H "X-Request-ID: 3" --compressed -v "http://localhost:1323/?my=param"
56+
```
57+
58+
*Log*
59+
```
60+
{"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}
61+
```

0 commit comments

Comments
 (0)