-
Notifications
You must be signed in to change notification settings - Fork 412
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
Optimize some zio.http.endpoint.Endpoint
code
#3213
Conversation
Please reopen when it builds |
a47f508
to
e1f0a79
Compare
@987Nabil Should be good now :) |
Replace the `NonEmptyChunk.formChunk(...).getOrElse(...)` with `chunk.nonEmptyOrElse(...)(...)`
e1f0a79
to
ab6e100
Compare
@@ -55,7 +55,8 @@ final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType]( | |||
codecError: HttpCodec[HttpCodecType.ResponseType, HttpCodecError], | |||
documentation: Doc, | |||
authType: Auth, | |||
) { self => | |||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated and unnecessary format change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
authCodec(auth1).orElseEither(authCodec(auth2))(Alternator.leftRightEqual[Unit]) | ||
} | ||
def authCodec(authType: AuthType): HttpCodec[HttpCodecType.RequestType, Unit] = | ||
authType match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated and unnecessary format change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
handlers: Chunk[(Handler[Env, Nothing, Request, Response], HttpCodec.Fallback.Condition)], | ||
): NonEmptyChunk[(Handler[Env, Response, Request, Response], HttpCodec.Fallback.Condition)] = { | ||
def noFound: NonEmptyChunk[(Handler[Env, Response, Request, Response], HttpCodec.Fallback.Condition)] = | ||
NonEmptyChunk( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we make this a constant?
Replace the
NonEmptyChunk.formChunk(...).getOrElse(...)
withchunk.nonEmptyOrElse(...)(...)
Removes an
Option
allocation