Skip to content

feat: Allow for request headers to be passed in#446

Open
camdecoster wants to merge 5 commits intomasterfrom
cam/445/add-headers
Open

feat: Allow for request headers to be passed in#446
camdecoster wants to merge 5 commits intomasterfrom
cam/445/add-headers

Conversation

@camdecoster
Copy link
Copy Markdown
Contributor

@camdecoster camdecoster commented Apr 22, 2026

Description

Allow for request headers to be passed from Kaleido to Choreographer.

Closes #445.

Changes

  • Add headers keyword argument for Kaleido class
  • Add tests

Testing

  • Check CI

# requires a couple extra lines
self.js_logger.reset()

await self._apply_headers()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a potential for a race condition here, where some requests might get sent before the headers are applied? Should _apply_headers() be called earlier in this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed, maybe? Moving this call earlier shouldn't hurt anything, so I'll do that.

"""Apply extra HTTP headers to the tab if configured."""
if self._headers:
_logger.debug2(f"Setting extra HTTP headers on {self.tab}")
_raise_error(await self.tab.send_command("Network.enable"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this "Network.enable" needed for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs to be called first so that the call to Network.setExtraHTTPHeaders will succeed.

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

Successfully merging this pull request may close these issues.

[FEATURE]: Allow request headers to be passed in to Choregrapher

3 participants