microsoft / microsoft/playwright-dotnet
[Feature]: IAPIRequestContext.GetAsync should be cancellable
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3k
- Forks
- 304
- Avg merge
- 20h 47m
- Merged PRs (30d)
- 6
Description
🚀 Feature Request
The API doesn't support CancellationToken anywhere. In issue #1652 it was explained that cancellation would be pointless in many UI-based cases.
However there are cases where it would be actually useful, and expected according to .NET standards.
For example: page.APIRequest.GetAsync. That initiates a network call and should definitely be cancellable.
Example
await page.APIRequest.GetAsync("https://www.example.com/foo", cancellationToken);
Motivation
A network call that cannot be cancelled is not standard .NET and surprising.
Notes
If the method uses HttpClient "under the hood", then one should simply provide it with the cancellation token. It probably that simple.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at IAPIRequestContext.GetAsync and trace the API request implementation to identify where the network call is made and how cancellation can be passed through. Check the existing request API and its tests for conventions around overloads and cancellation. Done means the example call accepts a CancellationToken and an in-flight request can be cancelled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100