You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Skip adding default content-type header 'application/x-www-form-urlencoded' if content is null #1083
I would like to ask you add a condition while adding the default 'Content-Type' header while preparing the requests, to verify the entity and if it's null then skip adding default 'Content-Type' header
if (bodyContents != null && HttpMethod.permitsRequestBody(method)) {
.
I agree with your reasoning from #966, that you want to allow the possibilities. On the other hand, few servers are too strict that they don't accept other kinds of 'Content-Type' that they don't support.
If you still want to keep the behavior same, I would like to understand the reasoning behind a different implementation for OkHttpClient.
Activity
karthik-119 commentedon May 28, 2025
As a last resort, please at least allow an option for the library user to decide what they want.