Mercurial
comparison third_party/wrk/scripts/auth.lua @ 186:8cf4ec5e2191 hg-web
Fixed merge conflict.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 23 Jan 2026 22:38:59 -0800 |
| parents | 94705b5986b3 |
| children |
comparison
equal
deleted
inserted
replaced
| 176:fed99fc04e12 | 186:8cf4ec5e2191 |
|---|---|
| 1 -- example script that demonstrates response handling and | |
| 2 -- retrieving an authentication token to set on all future | |
| 3 -- requests | |
| 4 | |
| 5 token = nil | |
| 6 path = "/authenticate" | |
| 7 | |
| 8 request = function() | |
| 9 return wrk.format("GET", path) | |
| 10 end | |
| 11 | |
| 12 response = function(status, headers, body) | |
| 13 if not token and status == 200 then | |
| 14 token = headers["X-Token"] | |
| 15 path = "/resource" | |
| 16 wrk.headers["X-Token"] = token | |
| 17 end | |
| 18 end |