From 774a599bdd32a6adf99cbf25e082f5eccb91942f Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 9 May 2016 11:28:11 +0200 Subject: [PATCH] Switch back to the last Java 7 compatible http4s version --- build.sbt | 6 ++++-- .../src/main/scala/coursier/SimpleHttpServer.scala | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 0904973a3..8b490bb44 100644 --- a/build.sbt +++ b/build.sbt @@ -506,13 +506,15 @@ lazy val plugin = project scriptedBufferLog := false ) +val http4sVersion = "0.8.6" + lazy val `simple-web-server` = project .settings(commonSettings) .settings(packAutoSettings) .settings( libraryDependencies ++= Seq( - "org.http4s" %% "http4s-blaze-server" % "0.13.2", - "org.http4s" %% "http4s-dsl" % "0.13.2", + "org.http4s" %% "http4s-blazeserver" % http4sVersion, + "org.http4s" %% "http4s-dsl" % http4sVersion, "org.slf4j" % "slf4j-nop" % "1.7.19", "com.github.alexarchambault" %% "case-app" % "1.0.0-RC2" ) diff --git a/simple-web-server/src/main/scala/coursier/SimpleHttpServer.scala b/simple-web-server/src/main/scala/coursier/SimpleHttpServer.scala index eb1640b56..8776432f3 100644 --- a/simple-web-server/src/main/scala/coursier/SimpleHttpServer.scala +++ b/simple-web-server/src/main/scala/coursier/SimpleHttpServer.scala @@ -5,8 +5,9 @@ import java.nio.channels.{ FileLock, OverlappingFileLockException } import org.http4s.dsl._ import org.http4s.headers.Authorization +import org.http4s.server.HttpService import org.http4s.server.blaze.BlazeBuilder -import org.http4s.{ BasicCredentials, Challenge, EmptyBody, HttpService, Request, Response } +import org.http4s.{ BasicCredentials, Challenge, EmptyBody, Request, Response } import caseapp._ @@ -122,7 +123,10 @@ case class SimpleHttpServerApp( auth.credentials match { case basic: BasicCredentials => if (basic.username == user && basic.password == password) - service.run(req) + service.run(req).flatMap { + case Some(v) => Task.now(v) + case None => NotFound() + } else { warn { val msg =