From 7a9756b150d16038b09aa3c9afe7523cf2fca8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Felipe=20Barco?= Date: Mon, 11 Aug 2025 16:32:05 -0500 Subject: [PATCH] Pass token headers only if not empty --- java/com/engflow/notificationqueue/Client.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/java/com/engflow/notificationqueue/Client.java b/java/com/engflow/notificationqueue/Client.java index 78dd1af..499e345 100644 --- a/java/com/engflow/notificationqueue/Client.java +++ b/java/com/engflow/notificationqueue/Client.java @@ -84,12 +84,14 @@ public static void main(String[] args) throws Exception { } try { final Metadata header = new Metadata(); - Metadata.Key methodKey = - Metadata.Key.of("x-engflow-auth-method", Metadata.ASCII_STRING_MARSHALLER); - header.put(methodKey, "jwt-v0"); - Metadata.Key tokenKey = - Metadata.Key.of("x-engflow-auth-token", Metadata.ASCII_STRING_MARSHALLER); - header.put(tokenKey, clientOptions.getOption("token")); + if (!Strings.isNullOrEmpty(clientOptions.getOption("token"))) { + Metadata.Key methodKey = + Metadata.Key.of("x-engflow-auth-method", Metadata.ASCII_STRING_MARSHALLER); + header.put(methodKey, "jwt-v0"); + Metadata.Key tokenKey = + Metadata.Key.of("x-engflow-auth-token", Metadata.ASCII_STRING_MARSHALLER); + header.put(tokenKey, clientOptions.getOption("token")); + } pull(channel, clientOptions.getOption("queue_name"), header, forwardChannel); } finally { if (channel != null) {