httpGet can't send body in request
See original GitHub issueI’m creating an android app using Fuel for kotlin and i need to send a GET request to the server with a body but got “Exception : method does not support a request body: GET”. How can I send a body with my GET request ?
I follow you my function:
fun getFunc (data: JSONObject, url : String): String {
lateinit var ret : String
thread {
FuelManager.instance.basePath = "https://blih.epitech.eu"
Fuel.upload(url, Method.GET)
.source { _, _ -> File.createTempFile(".temp", ".tmp") }
.body(data.toString().toByteArray())
.header("Content-Type" to "application/json")
.response { request, response, result ->
val (bytes, error) = result
if (bytes != null) {
println("[response bytes] ${String(bytes)}")
}
ret = response.toString()
println("error: $error")
}
}
Thread.sleep(1000)
return ret
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Unable to send request body in Http GET method on angular 10
Our api server need empty request body object in GET request. I want like this { method: 'get', url: 'http://domain.api.com/api/method?param1= ...
Read more >Request bodies in GET requests - Evert Pot
Yes. In other words, any HTTP request message is allowed to contain a message body, and thus must parse messages with that in...
Read more >What is HTTP GET Request Method? - ReqBin
No, HTTP GET requests cannot have a message body. But you still can send data to the server using the URL parameters. In...
Read more >is there anyway to send body request with get method?
No, We cannot send Body with GET Method. The Purpose of GET is to retrieve data. If i take example of database then...
Read more >Communicating with backend services using HTTP - Angular
For all HttpClient methods, the method doesn't begin its HTTP request until ... and causes HttpClient to compose and send the HTTP request...
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
Not allow to send body in
GET
request is a strange restriction. As @SleeplessByte said that unreasonable constraint was already dropped from the RFC. Meanwhile many famous projects’ apis take body inGET
request (Elasticsearch for example).So will
fuel
plan to remove the restriction? Otherwise we have to usePOST
method to get something when the query is complicated (hope luckily the server support both post and get).Hi @emanuele-dedonatis . Unfortunately we’re still constraint by the underlying HTTP library.