Skip to content

Decrement pendingRequests counter when Bun.serve responds with HTTP 413#18833

Open
CMTegner wants to merge 1 commit intooven-sh:mainfrom
CMTegner:decrement-pending-requests-on-413-response
Open

Decrement pendingRequests counter when Bun.serve responds with HTTP 413#18833
CMTegner wants to merge 1 commit intooven-sh:mainfrom
CMTegner:decrement-pending-requests-on-413-response

Conversation

@CMTegner
Copy link

@CMTegner CMTegner commented Apr 7, 2025

What does this PR do?

This change decrements the Server#pendingRequests counter when a request exceeds the maxRequestBodySize value passed to Bun.serve().

  • Code changes

How did you verify your code works?

Added an additional assertion to the existing HTTP 413 test, ensuring that server.pendingRequests returns to 0.

  • I wrote TypeScript/JavaScript tests and they pass locally (bun-debug test test-file-name.test)

@CMTegner
Copy link
Author

CMTegner commented May 5, 2025

I'm not sure what the correct procedure is to request a review, so I'll just take a shot in the dark and ping @Jarred-Sumner

Comment on lines +6804 to 6805
this.pending_requests -= 1;
this.finalize();
Copy link
Author

Choose a reason for hiding this comment

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

It looks like finalize() is only used in this conditional, so the statement to decrement pending_requests could possibly be moved if that's preferable.

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.

1 participant