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

Added getAs for QueryParams - errors enhancement #2510

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

BanyMaciej
Copy link
Contributor

Continuation of #2505

}
def getAllAs[A](key: String)(implicit codec: TextCodec[A]): Either[QueryParamsError, Chunk[A]] = for {
params <- map.get(key).toRight(QueryParamsError.Missing(key))
(failed, typed) = params.map(p => codec.decode(p).toRight(p)).partitionMap(identity)
Copy link
Contributor

@guersam guersam Nov 8, 2023

Choose a reason for hiding this comment

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

partitionMap(identity) seems redundant.

Suggested change
(failed, typed) = params.map(p => codec.decode(p).toRight(p)).partitionMap(identity)
(failed, typed) = params.partitionMap(p => codec.decode(p).toRight(p))

@codecov-commenter
Copy link

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (9909ee1) 64.95% compared to head (e5544cc) 64.96%.
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2510      +/-   ##
==========================================
+ Coverage   64.95%   64.96%   +0.01%     
==========================================
  Files         136      137       +1     
  Lines        7197     7208      +11     
  Branches     1296     1288       -8     
==========================================
+ Hits         4675     4683       +8     
- Misses       2522     2525       +3     
Files Coverage Δ
...ttp/src/main/scala/zio/http/QueryParamsError.scala 0.00% <0.00%> (ø)
zio-http/src/main/scala/zio/http/QueryParams.scala 84.09% <80.00%> (-1.21%) ⬇️

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

@987Nabil 987Nabil merged commit 735d9b7 into zio:main Nov 8, 2023
14 checks passed
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.

None yet

4 participants