Skip to content

RestTemplateBuilder's requestFactory override makes it incompatible with MockRestServiceServer #18091

Closed
@snicoll

Description

@snicoll

In #17091 we've moved some of the customizations of RestTemplateBuilder from a regular interceptor to a wrapping ClientHttpRequestFactory. This makes the created RestTemplate incompatible with MockRestServiceServer as the latter will override the ClientHttpRequestFactory when it binds a rest template to a mock server.

I am not sure how we could avoid that really as the purpose of the factory is to create a request and it must be mocked.

I discovered this as part of testing a component that valides the proper Authorization header is sent. Because the factory is overridden, this header isn't processed at all anymore when managed by MockRestServiceServer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions