Support Content type "application/x-www-form-urlencoded" with sending KeyValue params
See original GitHub issueUpdate:
Here is the Wiki/README/How-to link after the issue was resolved
Issue description
Content type “application/x-www-form-urlencoded” is not supported. Request body is always considered as Json or Multipart.
My rest controlled looks something like below,
@POST
@Consumes({"application/x-www-form-urlencoded"})
public Response handleRequest(MultivaluedMap<String, String> params) {
}
I tried using the below format. But it was failing.
"request": {
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"body": {
"Name": "Larry Pg",
"Company": "Amazon",
"Title": "CEO"
}
}
Like to change the method createRequestBuilder of the class BasicHttpClient.
Bit more details:
Not working ❌
-
What is expected ?
Content-Type
withapplication/x-www-form-urlencoded
with request body should be sent as Key-Value? But sent astext
? Expected: The serve should receive or interpret this as Key-Value pairs?
-
What is actual?
- It is sent as Text from client(zerocode)? And the server reads as text?
Working ✅
-
What is expected ?
Content-Type
withapplication/x-www-form-urlencoded
- when sent in the URL like query params, the server receives as Key-Value param
-
What is actual?
- It is sent like query params from client(zerocode)? and the server reads as Key-Value params?
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Handling URL Encoded Form Data in Spring REST - Baeldung
An HTTP request that sends application/x-www-form-urlencoded data must specify this in the Content-Type header. Internally, Spring uses the ...
Read more >How to send x-www-form-urlencoded keyValue pair parameters
Hi, I have a post request where i need to send x-www-form-urlencoded keyValue pair parameters and content-type should be x-www-form-urlencoded.
Read more >How do I POST a x-www-form-urlencoded request using Fetch?
In both cases you have 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' so you are claiming to be sending Form Encoded data in both cases. Use ...
Read more >POST - HTTP - MDN Web Docs
A POST request is typically sent via an HTML form and results in a change on the server. In this case, the content...
Read more >Retrofit — Send Data Form-Urlencoded - Future Studio
Place your desired key inside the @Field("key") annotation to define the parameter name. Further, add the type of your value as the method ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had all my endpoints configured in Postman. I came across this situation, when trying to move all of them to zerocode.
FYI In postman, Body is send as key-value pair. It’s also accepting query params & received as key-value pair. If we do not want to consider body, that’s ok. But it’ll make some confusion.
In my case, key is a simple text and value is a big json ( Ex : address={“unit-no”:"12-07"“block-number”:"33"“apartment”:“Flamingo Valley”,“state/region”:“singapore north”“country”:“singapore”“pincode”:“87654321”} ). It’s too hard to keep them in the url.
Anyway, let’s decide by others thought and specifications. Thanks.
Folks, all concerns have been taken care now in the PR. Please have a look, review n approve- Overall the below things has been take care n will be available once merged -
body
can be passed as key-value pair for thisheader
type - let’s keep this feature as this is a natural choice for users (we can add into readme 👍 @arunvelusamyd )queryParams
also now has been enhanced to take care of special chars - the similar logic from the PR has been implementedpublic
intentionally as they are already in use in the corporates, where they put their custom logic/headers/request-builder/corporate-prosy etc via@UseHttpClient
. Just a note of caution not to make it privatebody
andqueryParams
handling1.2.9-SNAPSHOT
build 👍I will keep it open for a day and merge it. If it is super urgent, let me know !
@officiallysameer @dinesh76in @macrocks @cooljavadev FYA please.