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

WIP #2074

Merged
merged 9 commits into from
Apr 2, 2023
Merged

WIP #2074

merged 9 commits into from
Apr 2, 2023

Conversation

jdegoes
Copy link
Member

@jdegoes jdegoes commented Mar 30, 2023

  • Polish ZClient
  • Polish URL
  • Polish Http
  • Polish Handler


def toForm: Form = Form.fromQueryParams(self)

def toMap: Map[String, Chunk[String]] = map
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks a bit confusing that

  • we are extending Map[String, Chunk[String]]
  • also have a public field map: Map[String, Chunk[String]]
  • and a toMap: Map[String, Chunk[String]]

and self is not the same map as the "inner map"; one could ask what is the difference (apart from having extra methods on QueryParams), are all map operations equivalent to regardless when you call toMap, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, will clean up 👍

@@ -28,60 +28,43 @@ import zio.http.socket.SocketApp
import java.net.{InetSocketAddress, URI} // scalafix:ok;

trait ZClient[-Env, -In, +Err, +Out] extends HeaderOps[ZClient[Env, In, Err, Out]] { self =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I moved config to ZClient.Config, I was wondering it would look better to have Client as the "main" companion object, hand have the layers and config class in that instead of ZClient. Would be more symmetric to Server.

Copy link
Member Author

Choose a reason for hiding this comment

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

How about val Client = ZClient or is that too ZIO 1.0-ish?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's the best we came up with when using this more polymorphic variant pattern.

Copy link
Contributor

@vigoo vigoo Mar 31, 2023

Choose a reason for hiding this comment

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

We already have that. I proposed to switch them and make Client the "real" object, because right now in type signatures you have to use ZClient.Config

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we just need a type alias? type Client = ZClient.type

Copy link
Member Author

Choose a reason for hiding this comment

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

We could do trait Client[...] extends Client.Poly[...]

@codecov-commenter
Copy link

codecov-commenter commented Mar 31, 2023

Codecov Report

Patch coverage: 49.52% and project coverage change: +0.12 🎉

Comparison is base (f4953cf) 66.66% compared to head (2be34c2) 66.79%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2074      +/-   ##
==========================================
+ Coverage   66.66%   66.79%   +0.12%     
==========================================
  Files         140      140              
  Lines        5817     5815       -2     
  Branches      226      232       +6     
==========================================
+ Hits         3878     3884       +6     
+ Misses       1939     1931       -8     
Impacted Files Coverage Δ
zio-http/src/main/scala/zio/http/Handler.scala 61.37% <0.00%> (ø)
zio-http/src/main/scala/zio/http/Http.scala 69.06% <0.00%> (ø)
zio-http/src/main/scala/zio/http/Proxy.scala 100.00% <ø> (ø)
zio-http/src/main/scala/zio/http/Response.scala 49.41% <0.00%> (ø)
...ain/scala/zio/http/endpoint/EndpointExecutor.scala 45.45% <0.00%> (ø)
...io/http/middleware/RequestHandlerMiddlewares.scala 69.23% <0.00%> (ø)
...o-http/src/main/scala/zio/http/model/Version.scala 28.57% <0.00%> (-21.43%) ⬇️
...a/zio/http/netty/client/ClientRequestEncoder.scala 100.00% <ø> (ø)
zio-http/src/main/scala/zio/http/ZClient.scala 27.19% <20.51%> (+4.05%) ⬆️
...io-http/src/main/scala/zio/http/model/Header.scala 61.87% <50.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jdegoes
Copy link
Member Author

jdegoes commented Apr 1, 2023

@vigoo Appreciate a review if you get a chance, would like to split this up since it's already so big.

@jdegoes jdegoes merged commit e42c759 into zio:main Apr 2, 2023
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.

4 participants