-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(null-bodies): empty bodies handling #2931
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryAdded proper handling for HTTP status codes that must not have response bodies (101, 204, 205, 304) by checking the status code before attempting to read the response body. Previously, calling Key changes:
Impact:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Tool as Discord/API Tool
participant Execute as executeToolRequest
participant Fetch as secureFetchWithPinnedIP
participant API as External API
participant Response as Response Handler
Tool->>Execute: Execute tool request
Execute->>Fetch: Make HTTP request (DELETE/PUT)
Fetch->>API: Send request
API-->>Fetch: 204 No Content (empty body)
Fetch-->>Execute: secureResponse (status 204)
alt Status in nullBodyStatuses (101, 204, 205, 304)
Execute->>Response: new Response(null, {status, headers})
Note over Execute,Response: Skip arrayBuffer() call<br/>to avoid errors
else Other statuses
Execute->>Fetch: await arrayBuffer()
Execute->>Response: new Response(bodyBuffer, {status, headers})
end
alt response.ok
Response->>Execute: Parse success response
alt status === 202 || status === 204
Execute->>Tool: Return {status}
else
Execute->>Response: await response.json()
Execute->>Tool: Return parsed data
end
else !response.ok
Response->>Execute: Handle error
Execute->>Tool: Throw error
end
|
|
@cursor review |
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
Need to have null body handling in execute tool. e.g. Discord tools killing execution because of errors.
Type of Change
Testing
Tested manually
Checklist