You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@DavidWohlsecker, I tried the below code to get the response header and using it on further requests.
cordovaHTTP.post(url, jsonParam,{"Content-Type":"application/x-www-form-urlencoded"}, function(response) {
try {
cordovaHTTP.setHeader("Cookie", response.headers["Set-Cookie"]);
}
catch(Exception e){
},function(response){
}
});
Hello,
I have a problem with getting the Set-Cookie Header from post HTTP requests.
I checked the java code and found this:
protected void addResponseHeaders(HttpRequest request, JSONObject response) throws JSONException {
Map<String, List> headers = request.headers();
Map<String, String> parsed_headers = new HashMap<String, String>();
for (Map.Entry<String, List> entry : headers.entrySet()) {
String key = entry.getKey();
List value = entry.getValue();
if ((key != null) && (!value.isEmpty())) {
parsed_headers.put(key, value.get(0));
}
}
response.put("headers", new JSONObject(parsed_headers));
}
The problem is that "Set-Cookie" is splitted into more header fields. And it only takes the first set-cookie header.
But I need all of them.
The text was updated successfully, but these errors were encountered: