-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: support adding extra headers to mcp for each request #692
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -102,3 +102,22 @@ describe('McpContext', () => { | |||||||
| ); | ||||||||
| }); | ||||||||
| }); | ||||||||
|
|
||||||||
| describe('McpContext headers functionality', () => { | ||||||||
| it('works with headers in context options', async () => { | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test seems to test nothing. |
||||||||
| await withMcpContext(async (_response, context) => { | ||||||||
| const page = context.getSelectedPage(); | ||||||||
| await page.setContent('<html><body>Test page</body></html>'); | ||||||||
|
|
||||||||
| // Verify context was created successfully | ||||||||
| assert.ok(context); | ||||||||
|
|
||||||||
| // Test that we can make a request (headers should be applied if any) | ||||||||
| const navigationPromise = page.goto('data:text/html,<html><body>Test</body></html>'); | ||||||||
| await navigationPromise; | ||||||||
|
Comment on lines
+116
to
+117
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| // If we reach here without errors, headers functionality is working | ||||||||
| assert.ok(true); | ||||||||
| }, { debug: false }); | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| }); | ||||||||
| }); | ||||||||
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 should not happen in the NetworkCollector. Collectors are there to get "collect" data from the pages as things happen. The code should live inside the McpContext class.