newClientFromWorld creates a client using the authentication configured in World.
(w *world.World)
| 62 | |
| 63 | // newClientFromWorld creates a client using the authentication configured in World. |
| 64 | func newClientFromWorld(w *world.World) (*client, error) { |
| 65 | options := defaultClientOptions() |
| 66 | if w.Timeout > 0 { |
| 67 | options.timeout = w.Timeout |
| 68 | } |
| 69 | options.customHeaders = w.CustomHeaders |
| 70 | |
| 71 | // Access tokens take precedence when both auth modes are populated. |
| 72 | if w.AccessToken != "" { |
| 73 | return newClient(w.URL, w.AccessToken, "", "", options) |
| 74 | } |
| 75 | return newClient(w.URL, "", w.ServiceAccount, w.ServiceAccountSecret, options) |
| 76 | } |
| 77 | |
| 78 | type customHeaderFlag struct { |
| 79 | headers *http.Header |