我知道JSON RPC与HTTP没有直接规定,但是我找不到一个合适的解决方案。问题是,哪种
通过调查流行的jsonRPC4J java lib ,发现它们在客户端中设置了(2)。
对我来说,最佳实践是为了“安全起见”而接受两者?
content-type
是正确的:
content-type: application/json
content-type: application/json-rpc
- 两者都可以?
通过调查流行的jsonRPC4J java lib ,发现它们在客户端中设置了(2)。
/**
* Prepares a connection to the server.
* @param extraHeaders extra headers to add to the request
* @return the unopened connection
* @throws IOException
*/
protected HttpURLConnection prepareConnection(Map<String, String> extraHeaders)
throws IOException {
...
con.setRequestProperty("Content-Type", "application/json-rpc");
// return it
return con;
}
对我来说,最佳实践是为了“安全起见”而接受两者?