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

PathParams middleware #270

Merged
merged 4 commits into from
Jul 22, 2019
Merged

PathParams middleware #270

merged 4 commits into from
Jul 22, 2019

Conversation

teamon
Copy link
Member

@teamon teamon commented Dec 17, 2018

Implementation of #249

TODO:

  • Update README
  • Add module docs

cc @jcabotc

@codecov
Copy link

codecov bot commented Dec 17, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@eaf4642). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #270   +/-   ##
========================================
  Coverage          ?   95.4%           
========================================
  Files             ?      23           
  Lines             ?     457           
  Branches          ?       0           
========================================
  Hits              ?     436           
  Misses            ?      21           
  Partials          ?       0
Impacted Files Coverage Δ
lib/tesla/middleware/path_params.ex 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eaf4642...6fd3bf4. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Dec 17, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@eaf4642). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #270   +/-   ##
========================================
  Coverage          ?   95.4%           
========================================
  Files             ?      23           
  Lines             ?     457           
  Branches          ?       0           
========================================
  Hits              ?     436           
  Misses            ?      21           
  Partials          ?       0
Impacted Files Coverage Δ
lib/tesla/middleware/path_params.ex 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eaf4642...6fd3bf4. Read the comment docs.

Copy link

@jcabotc jcabotc left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@chulkilee
Copy link
Contributor

Following cases should be considered and the expected behaviour must be in the test.

  • when value is not given: raise or pass the original value?
  • when nil value is given: should it replace it with empty string or nil or null or raise error?
  • when value with special value is given, such as /, #, ?: should it be urlencoded or not?
  • when a placeholder contains another placeholder as prefix: e.g. :id, :id_new
  • when a placeholder is part of query string or value, not path (e.g. /users?count=:count)

@teamon
Copy link
Member Author

teamon commented Jan 3, 2019

@chulkilee <3

I'd say, that:

  • when value is not given: keep placeholder "/users/:x" & [y: 1] ==> "/users/:id"
  • when nil value is given: I'm leaning towards requiring a binary, with auto to_string() as a second option
  • when value with special value is given, such as /, #, ?: should it be urlencoded or not?: I think it should
  • when a placeholder contains another placeholder as prefix: e.g. :id, :id_new: Ouh, nice catch. We could sort by key length or use regex to extract :[\w_]+ and do exact match
  • when a placeholder is part of query string or value, not path (e.g. /users?count=:count): I wouldn't support not forbid it - there is query: [a: 1] for this case

@teamon teamon self-assigned this Apr 24, 2019
@teamon teamon added the WIP label Apr 24, 2019
@teamon teamon removed their assignment Apr 24, 2019
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.

4 participants