diff --git a/example-consumer-app/java/Main.java b/example-consumer-app/java/Main.java index d4b09e05..e28a19ad 100644 --- a/example-consumer-app/java/Main.java +++ b/example-consumer-app/java/Main.java @@ -10,6 +10,7 @@ public class Main { private static final String URL = "https://catfact.ninja/fact"; private static final long SLEEP_INTERVAL_IN_SEC = 2; // seconds + private static final String X_LUNAR_CONSUMER_TAG = "lunar-example-app"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient.Builder() @@ -21,6 +22,7 @@ public static void main(String[] args) { while (!Thread.currentThread().isInterrupted()) { Request request = new Request.Builder() .url(URL) + .addHeader("x-lunar-consumer-tag", X_LUNAR_CONSUMER_TAG) .build(); try (Response response = client.newCall(request).execute()) { diff --git a/example-consumer-app/nodejs/main.js b/example-consumer-app/nodejs/main.js index bcd50674..8c41dbab 100644 --- a/example-consumer-app/nodejs/main.js +++ b/example-consumer-app/nodejs/main.js @@ -4,9 +4,15 @@ const readline = require('readline'); const URL = 'https://catfact.ninja/fact'; const SLEEP_INTERVAL_IN_SEC = 2000; // milliseconds +const X_LUNAR_CONSUMER_TAG = 'lunar-example-app'; const getCatFact = () => { - https.get(URL, (res) => { + const options = { + headers: { + 'x-lunar-consumer-tag': X_LUNAR_CONSUMER_TAG + } + }; + https.get(URL, options, (res) => { let data = ''; res.on('data', (chunk) => { diff --git a/example-consumer-app/python/main.py b/example-consumer-app/python/main.py index 45292fde..6b0f1b80 100644 --- a/example-consumer-app/python/main.py +++ b/example-consumer-app/python/main.py @@ -6,12 +6,15 @@ SLEEP_INTERVAL_IN_SEC = 2 URL = "https://catfact.ninja/fact" - +X_LUNAR_CONSUMER_TAG = "lunar-example-app" async def get_cat_fact(session, stop_event): while not stop_event.is_set(): try: - async with session.get(URL) as response: + headers = { + "x-lunar-consumer-tag": X_LUNAR_CONSUMER_TAG + } + async with session.get(URL, headers=headers) as response: if response.status == 200: fact = (await response.json()).get("fact") print(f"Cat Fact: {fact}")