HTTP 415 while sending JSON object using POST

前端 未结 2 1549
我在风中等你
我在风中等你 2021-02-12 12:56
import java.io.BufferedReader;    
import java.io.InputStreamReader;    
import java.net.HttpURLConnection;    
import java.net.URL;    
import java.io.DataOutputStream;         


        
2条回答
  •  生来不讨喜
    2021-02-12 13:20

    I was correctly passing

    Content-Type: application/json
    

    But my server was still rejecting the request because I was also passing

    Accept: application/json
    

    Which was not allowed in my case.

提交回复
热议问题