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
Question. This issue tracker is not the place for questions. If you want to ask how to do
something, or to understand why something isn't working the way you expect it to, use Stack
Overflow. https://stackoverflow.com/questions/tagged/retrofit
Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
already exists! Don’t send pull requests to implement new features without first getting our
support. Sometimes we leave features out on purpose to keep the project small.
I tried to use retrofit to send requests to a server that has some blocking rules. When I was trying to send a request to my backend with Multipart, it didn't reach my backend. I spent some time investigating why it happened and I found that my requisition lacked charset sent with multipart/form-data.
The code that I had to written on OkHttp:
val mediaType ="multipart/form-data; charset=utf-8".toMediaType()
val headers =Headers.headersOf("Content-Disposition", "form-data; name=\"myjson\"")
val multipartPartBody ="""{"body":"hello"}""".toRequestBody()
val multipartBody =MultipartBody.Builder()
.setType(mediaType)
.addPart(headers, multipartPartBody)
.build()
val request =Request.Builder()
.url(myUrl)
.put(multipartBody)
.build()
val response = client.newCall(request).execute()
I couldn't send this way to the backend with Retrofit
I just wanted a way to send a request with this charset with Retrofit
The text was updated successfully, but these errors were encountered:
It seems like this would also allow to send other multipart types like multipart/related or multipart/mixed. Or is there already some better way to do so using retrofit?
The way that retrofit builds a multipart/form-data it doesn't allow us to build a request with charset to utf-8 like multipart/form-data; charset=utf-8 which could lead to syntax errors. One example is like
The way that retrofit builds a multipart/form-data it doesn't allow us to build a request with charset to utf-8 like multipart/form-data; charset=utf-8 which could lead to syntax errors. One example is like
What kind of issue is this?
Question. This issue tracker is not the place for questions. If you want to ask how to do
something, or to understand why something isn't working the way you expect it to, use Stack
Overflow. https://stackoverflow.com/questions/tagged/retrofit
Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests
get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
already exists! Don’t send pull requests to implement new features without first getting our
support. Sometimes we leave features out on purpose to keep the project small.
I tried to use retrofit to send requests to a server that has some blocking rules. When I was trying to send a request to my backend with Multipart, it didn't reach my backend. I spent some time investigating why it happened and I found that my requisition lacked charset sent with multipart/form-data.
The code that I had to written on OkHttp:
I couldn't send this way to the backend with Retrofit
I just wanted a way to send a request with this charset with Retrofit
The text was updated successfully, but these errors were encountered: