|
|
@@ -29,7 +29,7 @@ public class HttpsUtils {
|
|
|
* @param outputStr 提交的数据
|
|
|
* @return json字符串
|
|
|
*/
|
|
|
- public static JSONObject doRequest(String requestUrl, String requestMethod, String outputStr) {
|
|
|
+ public static JSONObject doRequest(String requestUrl, String requestMethod, String outputStr, String token) {
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
|
JSONObject jsonObject;
|
|
|
try {
|
|
|
@@ -49,6 +49,9 @@ public class HttpsUtils {
|
|
|
httpUrlConn.setUseCaches(false);
|
|
|
// 设置请求方式(GET/POST)
|
|
|
httpUrlConn.setRequestMethod(requestMethod);
|
|
|
+ //设置Authorization授权token
|
|
|
+ httpUrlConn.setRequestProperty("Authorization", "bearer" + token);
|
|
|
+ httpUrlConn.setRequestProperty("Content-type", "application/json");
|
|
|
|
|
|
if ("GET".equalsIgnoreCase(requestMethod)) {
|
|
|
httpUrlConn.connect();
|