Skip to content

Update TestRestTemplate's default cookie handling to be the same as RestTemplate's #48607

@OrangeDog

Description

@OrangeDog

This is similar to #27360 (redirect handling).

Because I've moved from Undertow to Jetty as part of Boot 4 migration, I've discovered that different ClientHttpRequestFactory implementations handle cookies differently by default, and there's no property to control it (like spring.http.clients.redirects).

While the factory can be changed with spring.http.clients.imperative.factory, that doesn't help if there isn't one with the behaviour you want on the classpath.

In particular, a TestRestTemplate using HTTP_COMPONENTS will ignore cookies, while one using JETTY will manage a cookie jar internally. This will break some tests that are manually covering sessions and/or assuming independent requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions