Skip to content
Snippets Groups Projects
Commit 663b846a authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add example with custom header (Gitlab)

parent 2f15af79
Branches
No related tags found
1 merge request!5Extend authorization: update docs and help
......@@ -164,3 +164,28 @@ http.setAuth
http.makeRequest GET "api"
http.makeRequest GET "app"
```
## Gitlab access token
Gitlab uses the value `PRIVATE-TOKEN: <token>` in the request header for authorization.
Here we need `http.addHeader` to add a custom header line.
```sh
URL='https://gitlab.example.com/api/v4'
TOKEN='<add-your-token-here>' # glpat-**********
# ---------- init
http.init
http.addHeader "PRIVATE-TOKEN: $TOKEN"
http.setBaseUrl "$URL"
# ---------- Requests to api
http.makeRequest /users
http.getResponse | jq
http.makeRequest /projects
http.getResponse | jq
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment