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: patch-diff.githubusercontent.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:ed53ca15-42cf-981b-5def-24389ae55097 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ECF2:17C51:385067A:4CE8D26:6972CAA5 |
| html-safe-nonce | 3cdaaf43bc9b0d5ea943429c5a8bfb9de9d9b0b3243faadbb46da3c55d662c1a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQ0YyOjE3QzUxOjM4NTA2N0E6NENFOEQyNjo2OTcyQ0FBNSIsInZpc2l0b3JfaWQiOiIzNzM2MjkzNDIyMzc3NjUwODUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3e1d4fef784d945f91ead9bbcc6926aeb5dc3ccbf1b7d35f18ac2da771a3a811 |
| 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 | e5abb0753dbd4190d15d366a819b0ca85f68a7e5bbe3d32213b346c41685c80a |
| 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 | 88896109b054799a7f22afaeee541d00f9170dc3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width