From 4ba9ea1cba09844681474e5d785f35b8d22ec513 Mon Sep 17 00:00:00 2001 From: Christophe Lallement Date: Fri, 5 Apr 2024 14:44:01 -0400 Subject: [PATCH] fix(jersey3): When re got a 404, payload does not contain an InstanceInfo. --- .../transport/jersey3/AbstractJersey3EurekaHttpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eureka-client-jersey3/src/main/java/com/netflix/discovery/shared/transport/jersey3/AbstractJersey3EurekaHttpClient.java b/eureka-client-jersey3/src/main/java/com/netflix/discovery/shared/transport/jersey3/AbstractJersey3EurekaHttpClient.java index f2be9c922..479edf17c 100644 --- a/eureka-client-jersey3/src/main/java/com/netflix/discovery/shared/transport/jersey3/AbstractJersey3EurekaHttpClient.java +++ b/eureka-client-jersey3/src/main/java/com/netflix/discovery/shared/transport/jersey3/AbstractJersey3EurekaHttpClient.java @@ -147,7 +147,7 @@ public EurekaHttpResponse sendHeartBeat(String appName, String id, requestBuilder.accept(MediaType.APPLICATION_JSON_TYPE); response = requestBuilder.put(Entity.entity("{}", MediaType.APPLICATION_JSON_TYPE)); // Jersey3 refuses to handle PUT with no body EurekaHttpResponseBuilder eurekaResponseBuilder = anEurekaHttpResponse(response.getStatus(), InstanceInfo.class).headers(headersOf(response)); - if (response.hasEntity()) { + if (response.getStatus() != Status.NOT_FOUND.getStatusCode() && response.hasEntity()) { eurekaResponseBuilder.entity(response.readEntity(InstanceInfo.class)); } return eurekaResponseBuilder.build();