我想从以下内容中检索JSON数据:https: //git.eclipse.org/r/#/c/11376/
请求网址: https://git.eclipse.org/r/gerrit/rpc/ChangeDetailService
请求方法: POST
请求标题:
Accept:application/json
Content-Type:application/json; charset=UTF-8
Run Code Online (Sandbox Code Playgroud)
请求有效负载:
{"jsonrpc":"2.0","method":"changeDetail","params":[{"id":11376}],"id":1}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个答案,但我得到了400 BAD REQUEST.
任何人都可以帮我解决这个问题吗?
谢谢.
我正在尝试创建一个Android MD5哈希字符串,以等于下面的C#代码:
private string CalculateHMACMd5(string message, string key)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(key);
HMACMD5 hmacmd5 = new HMACMD5(keyByte);
byte[] messageBytes = encoding.GetBytes(message);
byte[] hashmessage = hmacmd5.ComputeHash(messageBytes);
string HMACMd5Value = ByteToString(hashmessage);
return HMACMd5Value;
}
private static string ByteToString(byte[] buff)
{
string sbinary = "";
for (int i = 0; i < buff.Length; i++)
{
sbinary += buff[i].ToString("X2");
}
return (sbinary);
}
Run Code Online (Sandbox Code Playgroud)
public static String sStringToHMACMD5(String sData, String sKey)
{
SecretKeySpec key;
byte[] bytes; …Run Code Online (Sandbox Code Playgroud) 我打算在Payload中发送一个带有大字符串的简单http post请求.
到目前为止,我有以下内容.
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("address location");
String cred = "un:pw";
byte[] authEncBytes = Base64.encodeBase64(cred.getBytes());
String authStringEnc = new String(authEncBytes);
httppost.setHeader("Authorization","Basic " + authStringEnc);
Run Code Online (Sandbox Code Playgroud)
但是,我不知道如何将简单的RAW字符串附加到有效负载中.我能找到的唯一例子是实体中的名称值对,但这不是我想要的.
任何帮助?