-
Notifications
You must be signed in to change notification settings - Fork 0
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
Check request size for POST and POSTForm requests #24
Conversation
WalkthroughThe update introduces a Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- api-client.ts (2 hunks)
Additional context used
Biome
api-client.ts
[error] 44-44: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
Additional comments not posted (3)
api-client.ts (3)
7-7
: LGTM!The
maxRequestSize
property is appropriately defined and initialized to 32 MB.
32-32
: LGTM!The request size check and error handling logic in the
POSTForm
method are correctly implemented.
65-65
: LGTM!The
getFormDataSize
method correctly calculates the size ofFormData
objects.
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.
Tests?
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
content.test.ts (1)
85-85
: LGTM! Consider adding a comment to explain the purpose of the test.The test case correctly checks if the system handles large request bodies by throwing an appropriate error.
To improve readability, consider adding a comment to explain the purpose of the test case.
+ // Test to ensure that requests with a body size exceeding the limit are rejected with an appropriate error
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- api-client.ts (3 hunks)
- content.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- api-client.ts
@@ -82,6 +82,12 @@ test( | |||
expect(content.version).toBe(0); | |||
expect(content.commands.length).toBe(1); | |||
|
|||
// check that prompt that is too large will fail gracefully without hitting the service | |||
const hugePrompt = "p".repeat(32 * 1000 * 1000); | |||
await expect(() => |
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.
Do you think this should be a separate test?
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.
I considered that, but prompt is a natural fit for testing this because it can be large but also easy to manipulate in test code.
Check request size for POST and POSTForm requests. Fixes #20
Summary by CodeRabbit
New Features
Tests