Permalink
Browse files

! can: model `user-agent-header` value as `User-Agent` to fail fast, f…

…ixes #458
  • Loading branch information...
jrudolph committed Oct 28, 2013
1 parent 572fd47 commit da12531b11bca7623f621fbeb7a6302aac265919
@@ -21,9 +21,10 @@ import scala.concurrent.duration.Duration
import akka.actor.ActorRefFactory
import spray.can.parsing.ParserSettings
import spray.util._
+import spray.http.HttpHeaders.`User-Agent`
case class ClientConnectionSettings(
- userAgentHeader: String,
+ userAgentHeader: Option[`User-Agent`],
idleTimeout: Duration,
requestTimeout: Duration,
reapingCycle: Duration,
@@ -52,7 +53,7 @@ object ClientConnectionSettings extends SettingsCompanion[ClientConnectionSettin
"Use Http.Connect(sslEncryption = true) to enable ssl encryption for a connection.")
apply(
- c getString "user-agent-header",
+ (c getString "user-agent-header" toOption).map(`User-Agent`(_)),
c getDuration "idle-timeout",
c getDuration "request-timeout",
c getDuration "reaping-cycle",
@@ -26,7 +26,7 @@ private[can] object RequestRendering {
def apply(settings: ClientConnectionSettings): PipelineStage =
new PipelineStage with RequestRenderingComponent {
- val userAgent = settings.userAgentHeader.toOption.map(`User-Agent`(_))
+ val userAgent = settings.userAgentHeader
val chunklessStreaming = settings.chunklessStreaming
def apply(context: PipelineContext, commandPL: CPL, eventPL: EPL): Pipelines =

0 comments on commit da12531

Please sign in to comment.