Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark/reset not supported after adding LogbookClientHttpRequestInterceptor with TRACE logging level #1738

Open
HaniBikdeli opened this issue Jan 20, 2024 · 1 comment

Comments

@HaniBikdeli
Copy link

Hi
Whenever I use rest template and adding LogbookClientHttpRequestInterceptor as an interceptor to my RestTemplate bean and setting the log level to TRACE i run into this exception: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://example.com": mark/reset not supported;

Description

I added the logbook-spring-boot-starter dependency in order to log the request and response of the third-party web services i consume using RestTemplate. Therefore I changed my RestTemplate bean to add the interceptor to it like this:

    @Bean
    public RestTemplate restTemplate(LogbookClientHttpRequestInterceptor interceptor) {
        RestTemplate restTemplate = new RestTemplate();
        List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
        interceptors.add(interceptor);
        restTemplate.setInterceptors(interceptors);
        return restTemplate;
    }

I also set the logging level to TRACE: org.zalando.logbook: TRACE.

When I try to call a web service using rest template the logging of the request works but just after that i get this exception:

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://example.com": mark/reset not supported; nested exception is java.io.IOException: mark/reset not supported

Expected Behavior

I expect to get a log of the request and then get the desired response along with a log of response and its body.

Actual Behavior

I get the request log but after that i encounter the exception mentioned above.

Possible Fix

Steps to Reproduce

  1. add the logbook-spring-boot-starter dependency
  2. add the LogbookClientHttpRequestInterceptor interceptor to the rest template bean
  3. set the logging level to TRACE

Context

I am trying to see a log of request and the response of the web services i'm consuming using rest template.

Your Environment

  • Version used:
  • Link to your project:
@kasmarian
Copy link
Member

Hi @HaniBikdeli, please help me reproduce the issue. I followed the steps you listed, but can see the logs. Could you create a repo where this is reproducible and share it here? Probably, some details are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants