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

Lucky::Params and escape hatch methods (from_json/query/form/multipart) #1053

Merged
merged 8 commits into from
Mar 20, 2020

Conversation

paulcsmith
Copy link
Member

This PR improves documentation in Lucky::Params as well as adds some methods for interacting with the raw data more easily if needed:

  • from_json
  • from_query
  • from_form
  • from_multipart

Just a simple delegate, but makes it easier to access just the query
params if you need to.

Part of the plan to add escape hatches to Lucky for more complex
scenarios where you need to get the low-level constructs.
@paulcsmith paulcsmith force-pushed the pcs/new-params-escape-hatches branch from f0d49cc to 168f374 Compare March 19, 2020 20:25
Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

This will be nice to get out there

src/lucky/params.cr Outdated Show resolved Hide resolved
@paulcsmith paulcsmith force-pushed the pcs/new-params-escape-hatches branch from 168f374 to 7578a11 Compare March 19, 2020 20:34
@paulcsmith paulcsmith force-pushed the pcs/new-params-escape-hatches branch from 7578a11 to e25384b Compare March 19, 2020 20:37
end
rescue JSON::ParseException
raise Lucky::ParamParsingError.new(request)
private memoize def parsed_json : JSON::Any
Copy link
Member

Choose a reason for hiding this comment

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

Does this work? 😂 I didn't know that!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup! It looks weird but macros before defs have to go between the private haha

@paulcsmith paulcsmith merged commit 9e61eff into master Mar 20, 2020
@paulcsmith paulcsmith deleted the pcs/new-params-escape-hatches branch March 20, 2020 11:23
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.

3 participants