-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Tables] Fix and enable Batch browser tests #13955
Conversation
@@ -9,117 +9,113 @@ import { isNode } from "../testUtils"; | |||
import { Uuid } from "../../src/utils/uuid"; | |||
import * as sinon from "sinon"; | |||
|
|||
if (isNode || isLiveMode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only line removed in this file. The rest is formatting from the prettier commit hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
const baseHeaders = getBaseBatchHeaders(batchGuid); | ||
return { | ||
...baseHeaders, | ||
// The below headers are not supported in the browser as they are flagged as "unsafe headers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about these unsafe headers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this fix!
Left a small suggestion about how the implementation could be tweaked.
* @internal | ||
* Builds an object with the required headers for a Batch request. For the Browser | ||
*/ | ||
export const getBatchHeaders = getBaseBatchHeaders; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be easier to write a function that filters out "unsafe" headers and apply that here, rather than relying on folks knowing to only add them to the node version?
Reading more specs, it looks that adding/setting/deleting/ forbidden headers should be a no-op. So it's the |
Fixes #11603
Accept-Charset
andConnection
headers are marked asunsafe
in some browsers. Fixing this issue by only adding them if running in Node