From 16b3b0a0f7c9a348267c4abedc0b45a89dce3ad1 Mon Sep 17 00:00:00 2001 From: Steve Black Date: Tue, 20 Aug 2024 08:29:21 -0500 Subject: [PATCH] Do not add Content-Type header for globus-proxy client. --- .../tacc/tapis/shared/security/ServiceClients.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tapis-shared-lib/src/main/java/edu/utexas/tacc/tapis/shared/security/ServiceClients.java b/tapis-shared-lib/src/main/java/edu/utexas/tacc/tapis/shared/security/ServiceClients.java index 084c23a9..11de2b55 100644 --- a/tapis-shared-lib/src/main/java/edu/utexas/tacc/tapis/shared/security/ServiceClients.java +++ b/tapis-shared-lib/src/main/java/edu/utexas/tacc/tapis/shared/security/ServiceClients.java @@ -319,6 +319,7 @@ private ITapisClient loadClient(String key) case TapisConstants.SERVICE_NAME_META: { client = new MetaClient(router.getServiceBaseUrl(), router.getAccessJWT()); + client.addDefaultHeader("Content-Type", "application/json"); break; } @@ -344,11 +345,15 @@ private ITapisClient loadClient(String key) if (client == null) throw new TapisException(MsgUtils.getMsg("TAPIS_CLIENT_NOT_FOUND", service, tenant, user)); - // Assign required headers. + // Assign headers required by all clients. client.addDefaultHeader("X-Tapis-User", user); client.addDefaultHeader("X-Tapis-Tenant", tenant); - client.addDefaultHeader("Content-Type", "application/json"); - + // NOTE that we do not add Content-Type header for globus-proxy client. Client is only used for GET. + // Including it can cause the globus-proxy service to return a 400. Header not needed for GET. + if (!TapisConstants.SERVICE_NAME_GLOBUSPROXY.equals(service)) { + client.addDefaultHeader("Content-Type", "application/json"); + } + // Return the client. return client; }