https icon indicating copy to clipboard operation
https copied to clipboard

iOS Response headers

Open fofaria opened this issue 6 years ago • 2 comments

When performing a HTTP request (any HTTP Verb), for the iOS, the response of the plugin has headers as an empty object: {}.

After a some investigation, it's clear that line 125 of https.ios.js, is always undefined and therefore we never get all headers from response. (AFResponse.task.response is always undefined)

    **var response = AFResponse.task.response;**
    if (!types_1.isNullOrUndefined(response)) {
        sendi.statusCode = response.statusCode;
        var dict = response.allHeaderFields;
        dict.enumerateKeysAndObjectsUsingBlock(function (k, v) {
            sendi.headers[k] = v;
        });
    }
    if (AFResponse.reason) {
        sendi.reason = AFResponse.reason;
    }
    return Promise.resolve(sendi);
});

Does anyone has the same issue? Or is there any workaround to get the headers from the response?

Thank you. @jeffwhelpley

fofaria avatar Jul 10 '19 02:07 fofaria

@fofaria i have the exact same issue right now. Investigating

farfromrefug avatar Jul 12 '19 11:07 farfromrefug

@farfromrefug thanks for the reply. Through Nativescript slack channel I got this answer as a workaround https://github.com/NativeScript/ios-runtime/issues/1149 see if it helps.

fofaria avatar Jul 12 '19 13:07 fofaria