Skip to content
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

Fix resource name when Grape paths contain a leading slash #4033

Merged

Conversation

jethrodaniel
Copy link
Contributor

@jethrodaniel jethrodaniel commented Oct 27, 2024

What does this PR do?

Fix an issue where a Grape resource like this

class TestingAPI < Grape::API
  get '/path/with/leading/slash' do
    'leading-slash'
  end
end

results in a resource TestingAPI GET //path/with/leading/slash, when it should result in TestingAPI GET /path/with/leading/slash.

Motivation:

Seeing the resource name have an unnecessary leading slash.

Change log entry

Fix resource name when Grape paths contain a leading slash

Additional Notes:

How to test the change?

rake test:grape

@jethrodaniel jethrodaniel force-pushed the fix-grape-resource-with-leading-slash branch from 81a501f to e845ee7 Compare October 27, 2024 21:59
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.82%. Comparing base (e8ef953) to head (1457102).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4033      +/-   ##
==========================================
- Coverage   97.82%   97.82%   -0.01%     
==========================================
  Files        1327     1327              
  Lines       79698    79717      +19     
  Branches     3952     3953       +1     
==========================================
+ Hits        77968    77983      +15     
- Misses       1730     1734       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jethrodaniel jethrodaniel marked this pull request as ready for review October 27, 2024 22:30
@jethrodaniel jethrodaniel requested a review from a team as a code owner October 27, 2024 22:30
@jethrodaniel jethrodaniel marked this pull request as draft October 27, 2024 22:32
@jethrodaniel jethrodaniel force-pushed the fix-grape-resource-with-leading-slash branch from e845ee7 to a2d62c3 Compare October 27, 2024 22:34
@jethrodaniel jethrodaniel force-pushed the fix-grape-resource-with-leading-slash branch from a2d62c3 to 9f46b17 Compare October 27, 2024 22:50
@jethrodaniel jethrodaniel marked this pull request as ready for review October 27, 2024 22:57
@jethrodaniel jethrodaniel changed the title fix grape leading slash resource issue Fix resource name when Grape paths contain a leading slash Oct 28, 2024
@jethrodaniel jethrodaniel requested a review from Strech October 28, 2024 18:57
Copy link
Member

@Strech Strech left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

Thanks for your time 💟

@p-datadog p-datadog merged commit 34f4808 into DataDog:master Oct 30, 2024
270 checks passed
@jethrodaniel jethrodaniel deleted the fix-grape-resource-with-leading-slash branch October 30, 2024 07:41
@p-datadog
Copy link
Member

We need to verify that http.route is the same as resource_name with respect to the leading slashes.

@TonyCTHsu TonyCTHsu added this to the 2.5.0 milestone Nov 5, 2024
@Strech
Copy link
Member

Strech commented Nov 5, 2024

Hey @jethrodaniel thanks for your contribution. This change was released as a part of v2.5.0 release. 🎉

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.

5 participants