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

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

Closed
snicoll opened this issue Sep 2, 2019 · 1 comment
Labels
status: duplicate A duplicate of another issue type: bug A general bug

Comments

@snicoll
Copy link
Member

snicoll commented Sep 2, 2019

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.

@snicoll snicoll added the type: bug A general bug label Sep 2, 2019
@snicoll snicoll added this to the 2.2.x milestone Sep 2, 2019
@snicoll
Copy link
Member Author

snicoll commented Sep 2, 2019

Duplicate of #17885

@snicoll snicoll marked this as a duplicate of #17885 Sep 2, 2019
@snicoll snicoll closed this as completed Sep 2, 2019
@snicoll snicoll added the status: duplicate A duplicate of another issue label Sep 2, 2019
@snicoll snicoll removed this from the 2.2.x milestone Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant