Closed BBackJK closed 9 months ago
I don't understand what you are trying to do? the example code doesn't use the field(,) method.
You also cannot use field
with a body of "application/json" because it is explicitly for multipart forms and url-encoded bodies and is NOT json
oooh I see, those methods are immutable, so you need to reassign it:
HttpRequestWithBody request = Unirest.request("POST", "http://localhost:8080/api/v1/post1");
request = request.header("Content-Type", "application/json");
request = request.body(SampleRequestDto.of("postJson1", "postJson2", "postJson3"));
Thank you for your reply. I may not have checked the document properly. I will refer to it and do nice coding. thank you
Describe the bug
I am trying to commonly call the http method through
UnirestInstance
, but the header and query parameters work normally, but thefield()
method used when x-www-urlencoded and thebody()
method used when application/json do not work.To Reproduce
Expected behavior It expects http to be called normally.
Environmental Data:
Additional context I think it's a bug caused by creating
HttpRequest<?>
with differentfield()
Method orbody()
Method.field()
returnsMultipartBody
,body()
returnsRequestBodyEntity
Please confirm.