Skip to content

Commit

Permalink
WOR-1389 fix npe (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoet authored Dec 4, 2023
1 parent fd583aa commit a964345
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.ws.rs.ext.Provider;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -87,7 +88,8 @@ public String getHttpRequestMethod(ClientRequestContext clientRequestContext) {
@Override
public List<String> getHttpRequestHeader(
ClientRequestContext clientRequestContext, String name) {
return clientRequestContext.getStringHeaders().get(name);
return Objects.requireNonNullElse(
clientRequestContext.getStringHeaders().get(name), List.of());
}

@Nullable
Expand All @@ -104,7 +106,7 @@ public List<String> getHttpResponseHeader(
ClientRequestContext clientRequestContext,
ClientResponseContext clientResponseContext,
String name) {
return clientResponseContext.getHeaders().get(name);
return Objects.requireNonNullElse(clientResponseContext.getHeaders().get(name), List.of());
}
}
}

0 comments on commit a964345

Please sign in to comment.