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

Response header overwrite on Android #377

Open
zoltanlorincz opened this issue Jul 30, 2024 · 0 comments
Open

Response header overwrite on Android #377

zoltanlorincz opened this issue Jul 30, 2024 · 0 comments

Comments

@zoltanlorincz
Copy link

Description:
Multiple Set-Cookie headers are valid response according to the RFC standard.

Steps to Reproduce:
Make a call to a an URL where multiple Set-Cookie headers are returned

Expected Behavior:
Further calls should be made with all cookies set.

Actual Behavior:
Only the last cookie is set.

Environment:
Library Version: all
React Native Version: all
Platform: Android

Cause:
The code in ReactNativeBlobUtilReq.java doesn't handle case when the same header received several times.
See below:

headers.putString(resp.headers().name(i), resp.headers().value(i));

The last value from Set-Cookie overwrites previous values.

private WritableMap getResponseInfo(Response resp, boolean isBlobResp) {
        WritableMap info = Arguments.createMap();
        info.putInt("status", resp.code());
        info.putString("state", "2");
        info.putString("taskId", this.taskId);
        info.putBoolean("timeout", timeout);
        WritableMap headers = Arguments.createMap();
        for (int i = 0; i < resp.headers().size(); i++) {
            headers.putString(resp.headers().name(i), resp.headers().value(i));
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant