-
Notifications
You must be signed in to change notification settings - Fork 283
Add NextLink spector scenario with Accept header validation #7553
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?
Conversation
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Instead of creating a new scenario, update the existing server-driven-pagination link scenario to include Accept header validation in both initial and subsequent requests, as suggested in PR feedback. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. |
response: { | ||
status: 200, | ||
body: json({ | ||
pets: FirstPage, | ||
next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link/nextPage`, | ||
}), | ||
}, | ||
handler: (req: MockRequest) => { |
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.
Why did we need to add a separate handler?
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.
Removed the redundant response fields. The handlers now properly validate the Accept header and return the response directly, following the established pattern used in other test files. Commit: 7c17320
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.
packages/playground build: vite v6.3.5 building for production...
packages/http-specs build: specs/payload/pageable/mockapi.ts(99,3): error TS2741: Property 'response' is missing in type '{ uri: string; method: "get"; request: { headers: { accept: string; }; }; handler: (req: MockRequest) => { status: number; body: MockBody; }; kind: "MockApiDefinition"; }' but required in type 'MockApiDefinition'.
packages/http-specs build: specs/payload/pageable/mockapi.ts(115,3): error TS2741: Property 'response' is missing in type '{ uri: string; method: "get"; request: { headers: { accept: string; }; }; handler: (req: MockRequest) => { status: number; body: MockBody; }; kind: "MockApiDefinition"; }' but required in type 'MockApiDefinition'.
packages/http-specs build: Failed
/mnt/vss/_work/1/s/packages/http-specs:
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
When using NextLink pagination, the Accept header should be included in subsequent requests to ensure proper content negotiation. However, there was no Spector scenario that validated this behavior.
This PR adds a new scenario
linkWithAccept
that specifically tests NextLink pagination with Accept header validation:New Scenario Added:
/payload/pageable/server-driven-pagination/link-with-accept
Accept: application/json
headerImplementation Details:
main.tsp
with comprehensive documentationTesting:
This ensures that client libraries properly maintain Accept headers across NextLink pagination requests, as documented in the TypeSpec pagination specification that states "header parameters are expected to be resent in the next request as those cannot be represented in the link."
Fixes #7547.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
http://168.63.129.16:80/machine/
/usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs
(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.