Skip to content

Conversation

@AnandRaj2224
Copy link
Contributor

The internal type OAuth::Params was redundant and used only by OAuth::Signature.
This refactor replaces it with URI::Params plus an RFC3986-compatible normalization method.
All stdlib specs pass (0 failures, 0 errors).
Fixes #16317

@AnandRaj2224
Copy link
Contributor Author

Updated according to review:

1.Removed OAuth::Params and replaced with URI::Params
2.Added add_query_params helper
3.Used URI.encode_www_form(..., space_to_plus: false) for RFC3986 compliance
4.Preserved legacy parameter order for clarity
5.Refactored normalization with String.build

All std specs are passing.
Please take a look when you can — thank you!

apply suggested loop style and variable naming from review

Co-authored-by: Julien Portalier <[email protected]>
Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

I have a few nitpicks, mostly about unnecessary stylistic changes, but also found semantic problems.

@AnandRaj2224
Copy link
Contributor Author

Hi @straight-shoota,
Just following up to see if you’ve had a chance to review this again.
I’ve implemented the RFC 5849–compliant change (encoding before sorting) and added the inline notes as suggested.
Everything’s passing and ready for another look when you have time — thanks again for your feedback earlier!

Copy link
Contributor

@ysbaddaden ysbaddaden left a comment

Choose a reason for hiding this comment

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

Just one last tidbit. Thanks for your patience with all these changes 🙇

@AnandRaj2224
Copy link
Contributor Author

Thanks @ysbaddaden
I applied all the suggested changes:

  • Replaced the manual flattening/String.build loop with 'params.map', using the encoded 'key' and 'value'.
  • Removed 'add_query_params' entirely and inlined the two 'URI::Params.parse' calls.

The code is now much cleaner and matches the recommended approach.
Let me know if you'd like anything else adjusted!

@ysbaddaden
Copy link
Contributor

Needs a crystal tool format, and that's it.

Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
@straight-shoota straight-shoota added this to the 1.19.0 milestone Nov 15, 2025
@straight-shoota straight-shoota changed the title Remove OAuth::Params: use URI::Params + RFC3986 serializer Remove internal type OAuth::Params Nov 17, 2025
@straight-shoota straight-shoota merged commit 0940ced into crystal-lang:master Nov 17, 2025
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop OAuth::Params

4 participants