Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Prevent logging unsafe header error #463

Merged
merged 1 commit into from
Apr 27, 2020
Merged

Conversation

PVince81
Copy link

Backend that don't support TUS will also not expose TUS headers through
CORS. To prevent the uncatchable "refused to get unsafe header", this
commit adds a workaround with a preliminary check using
"getAllResponseHeaders" to find out if the header is exposed by CORS
before reading it.

Fixes #462

@PVince81
Copy link
Author

PVince81 commented Apr 24, 2020

  • fix tests to also mock the getAllResponseHeaders call

Backend that don't support TUS will also not expose TUS headers through
CORS. To prevent the uncatchable "refused to get unsafe header", this
commit adds a workaround with a preliminary check using
"getAllResponseHeaders" to find out if the header is exposed by CORS
before reading it.
@PVince81 PVince81 force-pushed the prevent-unsafe-header-log branch from ae7c71d to e95bcd7 Compare April 27, 2020 05:33
@PVince81
Copy link
Author

I've fixed the tests by lower casing the "all headers" call, since the mocker from sinon did not lower case by default. It might also increase compatibility in case some browsers do not lower case by default either.

@PVince81 PVince81 merged commit b819b0d into master Apr 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the prevent-unsafe-header-log branch April 27, 2020 08:20
xoxys pushed a commit that referenced this pull request Apr 27, 2020
Merge: c690030 e95bcd7
Author: Vincent Petry <pvince81@owncloud.com>
Date:   Mon Apr 27 10:19:59 2020 +0200

    Merge pull request #463 from owncloud/prevent-unsafe-header-log

    Prevent logging unsafe header error
xoxys pushed a commit that referenced this pull request Apr 27, 2020
Merge: c690030 e95bcd7
Author: Vincent Petry <pvince81@owncloud.com>
Date:   Mon Apr 27 10:19:59 2020 +0200

    Merge pull request #463 from owncloud/prevent-unsafe-header-log

    Prevent logging unsafe header error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refused to get unsafe header "tus-version"
2 participants