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

Get transforms to Post if params given #230

Closed
wants to merge 1 commit into from

Conversation

rodrieiz
Copy link

I have the same issue that is mentioned here.
I think this is a possible solution that worked for me.

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.08%. Comparing base (53ad9b1) to head (5cccb81).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #230   +/-   ##
=======================================
  Coverage   97.08%   97.08%           
=======================================
  Files          20       20           
  Lines         618      618           
  Branches      142      142           
=======================================
  Hits          600      600           
  Misses         18       18           

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

@exoego
Copy link
Owner

exoego commented Apr 24, 2024

I don't get the issue.
Why you need to specify as: :json for get HTTP method?

@exoego
Copy link
Owner

exoego commented Apr 24, 2024

As the rspec-rails issue said,

      get "/users/1/billing_addresses",
          as: :json,
          headers: {},
          params: { some_param: {} } 

actually fails with No route matched for POST /users/1/billing_addresses, but it still fails even with this PR.

Please add a failing test first then change codes to fix the test.

@exoego exoego marked this pull request as draft April 24, 2024 02:08
@rodrieiz
Copy link
Author

I don't get the issue. Why you need to specify as: :json for get HTTP method?

Looking for an answer to your question about why I have to use as: :json, I think that's the issue. I shouldn't use it in GET requests. But since it was like that throughout the entire project, I kept using it. Thanks.

@rodrieiz
Copy link
Author

As the rspec-rails issue said,

      get "/users/1/billing_addresses",
          as: :json,
          headers: {},
          params: { some_param: {} } 

actually fails with No route matched for POST /users/1/billing_addresses, but it still fails even with this PR.

Please add a failing test first then change codes to fix the test.

In my case, the tests don't fail neither before nor after the PR. It's just that before, the documentation documented the endpoint as POST instead of GET. But as I mentioned in the previous comment, I think the issue lies in using as: :json

@rodrieiz rodrieiz closed this Apr 30, 2024
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.

2 participants