Title: Skip adding default content-type header 'application/x-www-form-urlencoded' if content is null · Issue #1083 · scribejava/scribejava · GitHub
Open Graph Title: Skip adding default content-type header 'application/x-www-form-urlencoded' if content is null · Issue #1083 · scribejava/scribejava
X Title: Skip adding default content-type header 'application/x-www-form-urlencoded' if content is null · Issue #1083 · scribejava/scribejava
Description: Dear ScribeJava, Library: https://github.com/scribejava/scribejava/tree/master/scribejava-httpclient-apache While building the request object: scribejava/scribejava-httpclient-apache/src/main/java/com/github/scribejava/httpclient/apache/...
Open Graph Description: Dear ScribeJava, Library: https://github.com/scribejava/scribejava/tree/master/scribejava-httpclient-apache While building the request object: scribejava/scribejava-httpclient-apache/src/main/java/...
X Description: Dear ScribeJava, Library: https://github.com/scribejava/scribejava/tree/master/scribejava-httpclient-apache While building the request object: scribejava/scribejava-httpclient-apache/src/main/java/...
Opengraph URL: https://github.com/scribejava/scribejava/issues/1083
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Skip adding default content-type header 'application/x-www-form-urlencoded' if content is null","articleBody":"Dear ScribeJava,\n\nLibrary: https://github.com/scribejava/scribejava/tree/master/scribejava-httpclient-apache\n\nWhile building the request object:\nhttps://github.com/scribejava/scribejava/blob/8970e8eeb0aff840d0b223890e9c392ee19218f7/scribejava-httpclient-apache/src/main/java/com/github/scribejava/httpclient/apache/ApacheHttpClient.java#L85\n\nI 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\n```Java\nprivate \u003cT\u003e Future\u003cT\u003e doExecuteAsync(String userAgent, Map\u003cString, String\u003e headers, Verb httpVerb,\n String completeUrl, HttpEntity entity, OAuthAsyncRequestCallback\u003cT\u003e callback,\n OAuthRequest.ResponseConverter\u003cT\u003e converter) {\n final RequestBuilder builder = getRequestBuilder(httpVerb);\n builder.setUri(completeUrl);\n\n if (entity != null \u0026\u0026 httpVerb.isPermitBody()) {\n if (!headers.containsKey(CONTENT_TYPE)) {\n builder.addHeader(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);\n }\n builder.setEntity(entity);\n }\n```\n\n just like the implementation of OkHttpClient lib: https://github.com/scribejava/scribejava/blob/8970e8eeb0aff840d0b223890e9c392ee19218f7/scribejava-httpclient-okhttp/src/main/java/com/github/scribejava/httpclient/okhttp/OkHttpHttpClient.java#L140.\n\nI agree with your reasoning from https://github.com/scribejava/scribejava/issues/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.\n\nIf you still want to keep the behavior same, I would like to understand the reasoning behind a different implementation for OkHttpClient.","author":{"url":"https://github.com/karthik-119","@type":"Person","name":"karthik-119"},"datePublished":"2025-05-28T09:26:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1083/scribejava/issues/1083"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1598ef8e-3392-58a7-7f9f-c2db013cd695 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE50:1EE1FC:6B8952:8EE7B2:6972E6FA |
| html-safe-nonce | f79a1e5102f487347b1dc2d15d3bda5724ff5e52616aac3f9aa9e02e1374cb35 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTUwOjFFRTFGQzo2Qjg5NTI6OEVFN0IyOjY5NzJFNkZBIiwidmlzaXRvcl9pZCI6IjU3MDA3MjY2MzM2Njg5OTQ4MTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f6ea80f6ef3224916d3e8161fa801c440260c2ae0f4dfbe3bc534bc3f71484ef |
| hovercard-subject-tag | issue:3096679803 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scribejava/scribejava/1083/issue_layout |
| twitter:image | https://opengraph.githubassets.com/729f8a1c696a3c6eae5159fea2dd137b6c3fdfd736f8f64694ae813ab9942bff/scribejava/scribejava/issues/1083 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/729f8a1c696a3c6eae5159fea2dd137b6c3fdfd736f8f64694ae813ab9942bff/scribejava/scribejava/issues/1083 |
| og:image:alt | Dear ScribeJava, Library: https://github.com/scribejava/scribejava/tree/master/scribejava-httpclient-apache While building the request object: scribejava/scribejava-httpclient-apache/src/main/java/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | karthik-119 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 824b30a290fe1f3775d1c3b755ace6ec71165752363f95d9255c1b87220040e4 |
| turbo-cache-control | no-preview |
| go-import | github.com/scribejava/scribejava git https://github.com/scribejava/scribejava.git |
| octolytics-dimension-user_id | 15140551 |
| octolytics-dimension-user_login | scribejava |
| octolytics-dimension-repository_id | 889932 |
| octolytics-dimension-repository_nwo | scribejava/scribejava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 889932 |
| octolytics-dimension-repository_network_root_nwo | scribejava/scribejava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7ef892904a22cef6ce15e4347cbf70e4cbfdc883 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width