Skip to content

Commit f0ea0fe

Browse files
committed
[master] - little changes in chrome mobile capabilities
1 parent d0c3569 commit f0ea0fe

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/main/java/http/connections/ConnectionBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public CloseableHttpResponse sendPOST(Map<Object, Object> map, String endpoint,
4949
System.out.println("\n\n------------------------------------------------------------");
5050
System.out.println("POST request to: " + url + endpoint);
5151
HttpPost request = new HttpPost(url + endpoint);
52-
// request.addHeader("Authorization", "Bearer " + token);
52+
request.addHeader("Authorization", "Basic " + token);
5353
// request.addHeader("Authorization", token);
5454
// request.addHeader("authorization", token);
5555
request.addHeader("Cookie", "AuthCookie=" + token);

src/main/java/http/helpers/Parser.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package http.helpers;
22

3+
import com.google.gson.JsonArray;
4+
import com.google.gson.JsonParser;
35
import org.json.simple.JSONObject;
46
import org.json.simple.parser.JSONParser;
57
import org.json.simple.parser.ParseException;
@@ -20,12 +22,12 @@
2022
public class Parser {
2123

2224
public static String getJSONValue(String jsonData, String key) throws ParseException {
23-
JSONObject json = (JSONObject)new JSONParser().parse(jsonData);
25+
JSONObject json = (JSONObject) new JSONParser().parse(jsonData);
2426

25-
return json.get(key).toString();
27+
return json.get(key).toString();
2628
}
2729

28-
public static String getDataValue(String json, String key) throws ParseException {
30+
public static String getDataValue(String json, String key) throws ParseException {
2931
return Parser.getJSONValue(json, key);
3032
}
3133

@@ -38,6 +40,10 @@ public static String getXMLValue(String xml, String selector) throws ParserConfi
3840
return nodes.item(0).getNodeValue();
3941
}
4042

43+
public static JsonArray jsonToJsonArray(String json, String key) throws ParseException {
44+
return (JsonArray) new JsonParser().parse(Parser.getJSONValue(json, key));
45+
}
46+
4147
public static List<String> getXMLValues(String xml, String selector) throws ParserConfigurationException, XPathExpressionException, IOException, SAXException {
4248
NodeList nodes = getNodeList(xml, selector);
4349
List<String> list = new ArrayList<String>();

0 commit comments

Comments
 (0)