Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get Header information from a request? #29

Open
lithiumlab opened this issue Jun 25, 2017 · 1 comment
Open

How to get Header information from a request? #29

lithiumlab opened this issue Jun 25, 2017 · 1 comment

Comments

@lithiumlab
Copy link

lithiumlab commented Jun 25, 2017

Amazing library;

i wonder how to get Header information?

    xhr.POST(Alloy.CFG.api_url +'/authenticate', login_data, onSuccessCallback, onErrorCallback,opts);

function onSuccessCallback(e){
    Ti.API.info('AUTH DATA:', e);
}

Only brings the body.
What about the Headers?

@lithiumlab
Copy link
Author

lithiumlab commented Jun 28, 2017

Adding:

result.headers = xhr.getResponseHeaders();

https://github.com/raulriera/XHR/blob/master/xhr.js#L276

Solves it for uncached calls.
But it needs to play nice with the cache writing process.

        var result = {};
        result.result = "cache";
        result.status = 304;
        result.headers = "cache";
        // not modified
        result.data = cache;
    onSuccess(result);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants