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

Unexpected char 0x0a at XX in authorization value #33

Open
bartoszwolski opened this issue Jun 5, 2018 · 0 comments
Open

Unexpected char 0x0a at XX in authorization value #33

bartoszwolski opened this issue Jun 5, 2018 · 0 comments

Comments

@bartoszwolski
Copy link

bartoszwolski commented Jun 5, 2018

I had an issue with this, and found out each headers value should be trimmed.

Its simple one line fix, adding
' val = val.trim();'

for (var i = 0; i < digestHeaders.length; i++) {
    var equalIndex = digestHeaders[i].indexOf('='),
        key = digestHeaders[i].substring(0, equalIndex),
        val = digestHeaders[i].substring(equalIndex + 1);
    val = val.replace(/['"]+/g, '');
    val = val.trim();
    // find realm
    if (key.match(/realm/i) != null) {
        self.realm = val;
    }
    // find nonce
    if (key.match(/nonce/i) != null) {
        self.nonce = val;
    }
    // find opaque
    if (key.match(/opaque/i) != null) {
        self.opaque = val;
    }
    // find QOP
    if (key.match(/qop/i) != null) {
        self.qop = val;
    }
}

inside this for loop

@inorganik correct me if I am wrong since I am super fresh in JS and RN, but this seems to fix an issue without breaking anything.

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