TotalCross / totalcross

TotalCross is a Software Development Kit that helps cross platform application development. Currently supported platforms are: Windows, Wince, Android, iOS, Linux and Linux ARM for embedded systems.
https://www.totalcross.com
GNU Lesser General Public License v2.1
222 stars 40 forks source link

Error send request in httpStream #362

Closed FelipeRodrigues21 closed 3 years ago

FelipeRodrigues21 commented 3 years ago

Hello Guys, how are you? When I will send the request(Verb POST) with body, in my application use httpStream, i receive in my response 415 HTTP code of my API. I did many tests in my API and it is work well. My API accept only json content type and in my app but, continue with with error HTTP code 415. Error bellow:

"ErrorUnsupported Media Type"

jeffque commented 3 years ago

Could you please write your request here?

Probably just a missing header, but to be sure I need to read the code

FelipeRodrigues21 commented 3 years ago

@jeffque i resolved the problem, it using method put of header, previously i was options.setContentType and the method doens' work. I think the error is the method setContentType.

FelipeRodrigues21 commented 3 years ago

Code bellow work:

Hashtable header = new Hashtable(0); header.put("Content-Type", "application/json");

Code bellow doens't work:

options.setContentType("application/json");

brunoamuniz commented 3 years ago

As the issue is solved, I am going to closed.

Cheers,