From 663b846a58df7026279f5b9bea00046861bbf260 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 23 Oct 2024 11:44:48 +0200
Subject: [PATCH] add example with custom header (Gitlab)

---
 docs/40_Examples.md | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/docs/40_Examples.md b/docs/40_Examples.md
index 785e054..1a8c857 100644
--- a/docs/40_Examples.md
+++ b/docs/40_Examples.md
@@ -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
+
+```
-- 
GitLab