Skip to content

Return 204 No Content from POST /proxy/mockRequest - #1991

Merged
waldekmastykarz merged 1 commit into
dotnet:mainfrom
waldekmastykarz:fix-1972-mockrequest-202
Oct 26, 2026
Merged

waldekmastykarz merged 1 commit into
dotnet:mainfrom
waldekmastykarz:fix-1972-mockrequest-202

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

Closes #1972

POST /proxy/mockRequest awaited the mock request and then returned 202 Accepted, even though the work was already done. It now returns 204 No Content.

Breaking change: clients that check for exactly 202 need to accept 204. The API docs (proxy-api.md) need a matching update.

Adds a unit test for ProxyController.RaiseMockRequestAsync.

The mock request has already been processed when the response is sent,
so 202 Accepted is misleading. Closes dotnet#1972

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 250031cc-f525-4369-a32a-0bd181e6f66a
Copilot AI balanced review requested due to automatic review settings October 21, 2026 13:57
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 21, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused change matches the expected behavior with no blocking issues identified; tests were not executed.

No open issues 🎉

What changed in this PR

Updates POST /proxy/mockRequest to return 204 No Content after processing completes, addressing #1972.

Changes:

  • Replaces 202 Accepted with NoContent() while preserving awaited processing.
  • Adds a unit test checking the result type and mock-request call count.

Clients expecting exactly 202 must accept 204; the API documentation needs a matching update.

File Description
DevProxy/​ApiControllers/​ProxyController.cs Returns 204 after the mock request completes.
DevProxy.Tests/​ProxyControllerTests.cs Adds regression coverage for the controller response.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused change preserves awaited processing, returns the intended status, and has no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@waldekmastykarz
waldekmastykarz merged commit 0e694ec into dotnet:main Oct 26, 2026
4 checks passed
@waldekmastykarz
waldekmastykarz deleted the fix-1972-mockrequest-202 branch October 26, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants