fix(api): use query params for --field with GET requests#59
Merged
Conversation
GET/HEAD requests cannot have a body, so --field values were causing 'Request with GET/HEAD method cannot have body' errors. Now fields are routed based on HTTP method: - GET: fields become URL query parameters - POST/PUT/PATCH/DELETE: fields become JSON request body Arrays use repeated keys per HTTP standard (tags=[1,2,3] → ?tags=1&tags=2&tags=3).
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Issue
Other
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ Patch coverage is 95.56%. Project has 1525 uncovered lines. Files with missing lines (18)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 55.92% 56.64% +0.72%
==========================================
Files 33 33 —
Lines 3480 3517 +37
Branches 0 0 —
==========================================
+ Hits 1946 1992 +46
- Misses 1534 1525 -9
- Partials 0 0 —Generated by Codecov Action |
Contributor
There was a problem hiding this comment.
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.
3 tasks
MathurAditya724
added a commit
that referenced
this pull request
Apr 6, 2026
The metrics feature was labeled 'Custom Metrics' in the feature selection prompt, which doesn't match Sentry's standard terminology. Rename to 'Metrics' for consistency. Closes getsentry/cli-init-api#59
MathurAditya724
added a commit
that referenced
this pull request
Apr 6, 2026
## Summary - Renames the metrics feature label from "Custom Metrics" to "Metrics" in the `sentry init` feature selection prompt - Updates the hint text from "Track custom business metrics" to "Track business metrics" The "Custom" qualifier is inaccurate and doesn't match how the feature is described elsewhere in Sentry's terminology. Closes getsentry/cli-init-api#59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
TypeError: Request with GET/HEAD method cannot have bodywhen usingsentry api --fieldwith GET requests.Changes
--fieldvalues become URL query parameters--fieldvalues become JSON request body (unchanged)tags=[1,2,3]→?tags=1&tags=2&tags=3)Files Changed
src/commands/api.ts- AddedbuildQueryParams(), updated command to route fields based on methodsrc/lib/api-client.ts- UpdatedbuildSearchParams()to handle string arrays for repeated keystest/commands/api.test.ts- Added tests forbuildQueryParams()