Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

IllegalArgumentException with empty requesty body using OkHttpRequestFactory #25

Closed
@WonderCsabo

Description

@WonderCsabo

When sending a request with empty body, an IllegalArgumentException is thrown if one uses the new OkHttpRequestFactory. The stacktrace is the following:

java.lang.IllegalArgumentException: method POST must have a request body.
    at com.squareup.okhttp.Request$Builder.method(Request.java:244)
    at org.springframework.http.client.OkHttpClientHttpRequest.executeInternal(OkHttpClientHttpRequest.java:85)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:84)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:91)
    at my.super.secret.package.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:29)
    at org.springframework.http.client.InterceptingClientHttpRequest$RequestExecution.execute(InterceptingClientHttpRequest.java:81)
    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:67)
    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:84)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:536)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:499)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:447)

This is a regression introduced by the new implementation of OkHttpRequestFactory added by the M3 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions