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

Option Client Decoding #2342

Merged
merged 4 commits into from Jan 11, 2019

Conversation

Projects
None yet
2 participants
@ChristopherDavenport
Copy link
Member

ChristopherDavenport commented Jan 4, 2019

Adds -

 def expectOptionOr[A](req: Request[F])(onError: Response[F] => F[Throwable])(implicit d: EntityDecoder[F, A]): F[Option[A]]
  def expectOptionOr[A](uri: Uri)(onError: Response[F] => F[Throwable])(implicit d: EntityDecoder[F, A]): F[Option[A]]
  def expectOptionOr[A](s: String)(onError: Response[F] => F[Throwable])(implicit d: EntityDecoder[F, A]): F[Option[A]]
  def expectOption[A](req: Request[F])(implicit d: EntityDecoder[F, A]): F[Option[A]]
  def expectOption[A](uri: Uri)(implicit d: EntityDecoder[F, A]): F[Option[A]]
  def expectOption[A](s: String)(implicit d: EntityDecoder[F, A]): F[Option[A]]

These methods decode and are Some on Succesful, and return None on 404. And have a failure mechanism similar to the expect line.

Open Questions - None on Gone?

ChristopherDavenport and others added some commits Jan 10, 2019

@ChristopherDavenport

This comment has been minimized.

Copy link
Member Author

ChristopherDavenport commented Jan 11, 2019

Is there a scalafmt:all. That runs all three? Could I add an alias for it so that I stop doing this all the time?

@ChristopherDavenport

This comment has been minimized.

Copy link
Member Author

ChristopherDavenport commented Jan 11, 2019

scalafmt and I get along so poorly. It's totally my fault however, so I am fully responsible.

@rossabaker

This comment has been minimized.

Copy link
Member

rossabaker commented Jan 11, 2019

test:scalafmt from the root project should take care of everything.

@rossabaker rossabaker merged commit bfd2ec5 into http4s:master Jan 11, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment