|
25 | 25 | import no.nav.vedtak.log.mdc.MDCOperations;
|
26 | 26 | import no.nav.vedtak.sikkerhet.context.SubjectHandler;
|
27 | 27 | import no.nav.vedtak.util.StringUtils;
|
| 28 | +import org.slf4j.Logger; |
| 29 | +import org.slf4j.LoggerFactory; |
28 | 30 |
|
29 | 31 | /**
|
30 | 32 | * Klassen legger dynamisk på headere for å propagere sikkerhetskonteks og callId
|
31 | 33 | */
|
32 | 34 | public abstract class AbstractOidcRestClient extends CloseableHttpClient {
|
| 35 | + private static final Logger logger = LoggerFactory.getLogger(AbstractOidcRestClient.class); |
| 36 | + |
33 | 37 | private static final String AUTH_HEADER = "Authorization";
|
34 | 38 | private static final String OIDC_AUTH_HEADER_PREFIX = "Bearer ";
|
35 | 39 | private static final String CALL_ID = "xCALL_ID";
|
@@ -88,6 +92,12 @@ public <T> T post(URI endpoint, Object dto, Class<T> clazz) {
|
88 | 92 | return fromJson(entity, clazz);
|
89 | 93 | }
|
90 | 94 |
|
| 95 | + public <T> T postAndLogRespons(URI endpoint, Object dto, Class<T> clazz) { |
| 96 | + String entity = post(endpoint, dto, createResponseHandler(endpoint)); |
| 97 | + logger.info("Respons fra endepunkt " + endpoint + "var " + entity); |
| 98 | + return fromJson(entity, clazz); |
| 99 | + } |
| 100 | + |
91 | 101 | public <T> Optional<T> postReturnsOptional(URI endpoint, Object dto, Class<T> clazz) {
|
92 | 102 | String entity = post(endpoint, dto, createResponseHandler(endpoint));
|
93 | 103 | if (StringUtils.nullOrEmpty(entity)) {
|
|
0 commit comments