From 9e862e68147427f5d5a2512dad0ea8fec32fa832 Mon Sep 17 00:00:00 2001 From: Dirk Sarodnick Date: Mon, 26 Feb 2018 11:15:05 +0100 Subject: [PATCH] #41 #45 carried already done fix over --- src/main/java/fr/delthas/skype/WebConnector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/delthas/skype/WebConnector.java b/src/main/java/fr/delthas/skype/WebConnector.java index 032c3ac..dbda162 100644 --- a/src/main/java/fr/delthas/skype/WebConnector.java +++ b/src/main/java/fr/delthas/skype/WebConnector.java @@ -118,7 +118,7 @@ private User updateUser(JSONObject userJSON, boolean newContactType) throws Pars String userAvatarUrl = null; try { if (!newContactType) { - userUsername = userJSON.getString("username"); + userUsername = userJSON.optString("username"); userFirstName = userJSON.optString("firstname", null); userLastName = userJSON.optString("lastname", null); userMood = userJSON.optString("mood", null); @@ -220,6 +220,7 @@ private Response sendRequest(Method method, String apiPath, boolean absoluteApiP logger.finest("Sending " + method + " request at " + url); if (skypeToken != null) { conn.header("X-Skypetoken", skypeToken); + conn.header("Accept", "application/json"); } else { logger.fine("No token sent for the request at: " + url); }