Skip to content

TestRestTemplate.withBasicAuth resets custom requestFactory #15443

@larsgrefer

Description

@larsgrefer

I'm currently using a RestTemplateCustomizer bean to set a custom request factory for all RestTemplate's:

https://github.com/freefair/okhttp-spring-boot/blob/f0f6dcc0ba685c40ebe15de725c1170307027173/autoconfigure/src/main/java/io/freefair/spring/okhttp/OkHttpRestTemplateAutoConfiguration.java#L22-L27

The TestRestTemplate I get injected into my unit tests also uses this custom request factory, but calling withBasicAuth() returns a new TestRestTemplate-instance which no longer contains the custom request factory but a default one.

Environment:
Spring Boot 2.1.1.RELEASE
OpenJDK 11

Similar issues:
see #7812
see #7441
see #7265

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by anothertype: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions