Java Post request with form data

前端 未结 1 457
后悔当初
后悔当初 2021-01-23 16:05

I want to make a simple POST call in Java,
I am getting a 200 response code but, with the wrong response message,
I am told there is a different way to make a Post call

相关标签:
1条回答
  • 2021-01-23 16:29

    Give a try by setting content type multipart/form-data explicitly,

    post.setHeader("Content-Type", "multipart/form-data");
    

    In your code ,

    post.setEntity(new UrlEncodedFormEntity(urlParameters)); 
    post.setHeader("Content-Type", "multipart/form-data");
    
    0 讨论(0)
提交回复
热议问题