diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index b74bed2e8..9fc64d688 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -13,3 +13,6 @@ a904e917d5851ebffc5e1eabbee70cf1685c4263
# Scala Steward: Reformat with scalafmt 3.10.3
245df4a95b09802b6c1ea2dbc429259b368bd0ef
+
+# Scala Steward: Reformat with scalafmt 3.10.4
+3a1f225850c219c27f8f1b30699aec4eea45923e
diff --git a/.scalafmt.conf b/.scalafmt.conf
index e4a8ff530..e50fb66f9 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -1,4 +1,4 @@
-version = 3.10.3
+version = 3.10.4
runner.dialect = scala213
project.git = true
style = defaultWithAlign
diff --git a/build.sbt b/build.sbt
index 0f6cb544d..7152fa5c6 100644
--- a/build.sbt
+++ b/build.sbt
@@ -44,7 +44,8 @@ inThisBuild(Def.settings(
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
onLoad in Global := {
sLog.value.info(
- s"Building Pekko HTTP ${version.value} against Pekko ${PekkoCoreDependency.version} on Scala ${(httpCore / scalaVersion).value}")
+ s"Building Pekko HTTP ${version.value} against Pekko ${PekkoCoreDependency.version} on Scala ${(httpCore /
+ scalaVersion).value}")
(onLoad in Global).value
},
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
@@ -424,8 +425,10 @@ lazy val docs = project("docs")
"javadoc.org.apache.pekko.link_style" -> "direct",
"scaladoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${PekkoCoreDependency.default.link}",
"scaladoc.org.apache.pekko.link_style" -> "direct",
- "javadoc.org.apache.pekko.http.base_url" -> s"https://pekko.apache.org/japi/pekko-http/${projectInfoVersion.value}",
- "scaladoc.org.apache.pekko.http.base_url" -> s"https://pekko.apache.org/api/pekko-http/${projectInfoVersion.value}",
+ "javadoc.org.apache.pekko.http.base_url" ->
+ s"https://pekko.apache.org/japi/pekko-http/${projectInfoVersion.value}",
+ "scaladoc.org.apache.pekko.http.base_url" ->
+ s"https://pekko.apache.org/api/pekko-http/${projectInfoVersion.value}",
"github.base_url" -> GitHub.url(version.value, isSnapshot.value)),
apidocRootPackage := "org.apache.pekko",
ValidatePR / additionalTasks += Compile / paradox)
diff --git a/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala b/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala
index 467bb51e2..6461bec4e 100644
--- a/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala
@@ -361,19 +361,18 @@ class HttpServerExampleSpec extends AnyWordSpec with Matchers
// needed for the future flatMap/onComplete in the end
implicit val executionContext = system.dispatcher
- val route =
- (put & path("lines")) {
- withoutSizeLimit {
- extractDataBytes { bytes =>
- val finishedWriting = bytes.runWith(FileIO.toPath(new File("/tmp/example.out").toPath))
-
- // we only want to respond once the incoming data has been handled:
- onComplete(finishedWriting) { ioResult =>
- complete("Finished writing data: " + ioResult)
- }
+ val route = (put & path("lines")) {
+ withoutSizeLimit {
+ extractDataBytes { bytes =>
+ val finishedWriting = bytes.runWith(FileIO.toPath(new File("/tmp/example.out").toPath))
+
+ // we only want to respond once the incoming data has been handled:
+ onComplete(finishedWriting) { ioResult =>
+ complete("Finished writing data: " + ioResult)
}
}
}
+ }
// #consume-raw-dataBytes
}
@@ -388,19 +387,18 @@ class HttpServerExampleSpec extends AnyWordSpec with Matchers
// needed for the future flatMap/onComplete in the end
implicit val executionContext = system.dispatcher
- val route =
- (put & path("lines")) {
- withoutSizeLimit {
- extractRequest { (r: HttpRequest) =>
- val finishedWriting = r.discardEntityBytes().future
-
- // we only want to respond once the incoming data has been handled:
- onComplete(finishedWriting) { done =>
- complete("Drained all data from connection... (" + done + ")")
- }
+ val route = (put & path("lines")) {
+ withoutSizeLimit {
+ extractRequest { (r: HttpRequest) =>
+ val finishedWriting = r.discardEntityBytes().future
+
+ // we only want to respond once the incoming data has been handled:
+ onComplete(finishedWriting) { done =>
+ complete("Drained all data from connection... (" + done + ")")
}
}
}
+ }
// #discard-discardEntityBytes
}
@@ -416,22 +414,21 @@ class HttpServerExampleSpec extends AnyWordSpec with Matchers
// needed for the future flatMap/onComplete in the end
implicit val executionContext = system.dispatcher
- val route =
- (put & path("lines")) {
- withoutSizeLimit {
- extractDataBytes { data =>
- // Closing connections, method 1 (eager):
- // we deem this request as illegal, and close the connection right away:
- data.runWith(Sink.cancelled) // "brutally" closes the connection
-
- // Closing connections, method 2 (graceful):
- // consider draining connection and replying with `Connection: Close` header
- // if you want the client to close after this request/reply cycle instead:
- respondWithHeader(Connection("close"))
- complete(StatusCodes.Forbidden -> "Not allowed!")
- }
+ val route = (put & path("lines")) {
+ withoutSizeLimit {
+ extractDataBytes { data =>
+ // Closing connections, method 1 (eager):
+ // we deem this request as illegal, and close the connection right away:
+ data.runWith(Sink.cancelled) // "brutally" closes the connection
+
+ // Closing connections, method 2 (graceful):
+ // consider draining connection and replying with `Connection: Close` header
+ // if you want the client to close after this request/reply cycle instead:
+ respondWithHeader(Connection("close"))
+ complete(StatusCodes.Forbidden -> "Not allowed!")
}
}
+ }
// #discard-close-connections
}
diff --git a/docs/src/test/scala/docs/http/scaladsl/server/CaseClassExtractionExamplesSpec.scala b/docs/src/test/scala/docs/http/scaladsl/server/CaseClassExtractionExamplesSpec.scala
index 86f0ac1aa..9ffc36d3d 100644
--- a/docs/src/test/scala/docs/http/scaladsl/server/CaseClassExtractionExamplesSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/server/CaseClassExtractionExamplesSpec.scala
@@ -55,12 +55,11 @@ class CaseClassExtractionExamplesSpec extends RoutingSpec with Inside {
// #example-3
case class Color(name: String, red: Int, green: Int, blue: Int)
- val route =
- (path("color" / Segment) & parameters("r".as[Int], "g".as[Int], "b".as[Int]))
- .as(Color.apply _) { color =>
- // ... route working with the `color` instance
- doSomethingWith(color) // #hide
- }
+ val route = (path("color" / Segment) & parameters("r".as[Int], "g".as[Int], "b".as[Int]))
+ .as(Color.apply _) { color =>
+ // ... route working with the `color` instance
+ doSomethingWith(color) // #hide
+ }
Get("/color/abc?r=1&g=2&b=3") ~> route ~> check { responseAs[String] shouldEqual "Color(abc,1,2,3)" } // #hide
// #example-3
}
@@ -77,7 +76,7 @@ class CaseClassExtractionExamplesSpec extends RoutingSpec with Inside {
"example 4 test" in {
val route =
(path("color" / Segment) &
- parameters("r".as[Int], "g".as[Int], "b".as[Int])).as(Color.apply _) { color =>
+ parameters("r".as[Int], "g".as[Int], "b".as[Int])).as(Color.apply _) { color =>
// ... route working with the `color` instance
doSomethingWith(color) // #hide
}
diff --git a/docs/src/test/scala/docs/http/scaladsl/server/DirectiveExamplesSpec.scala b/docs/src/test/scala/docs/http/scaladsl/server/DirectiveExamplesSpec.scala
index b644c20b4..a5710695c 100644
--- a/docs/src/test/scala/docs/http/scaladsl/server/DirectiveExamplesSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/server/DirectiveExamplesSpec.scala
@@ -102,10 +102,9 @@ class DirectiveExamplesSpec extends RoutingSpec with CompileOnlySpec {
"example-6" in {
// #example-6
val getOrPut = get | put
- val route =
- (path("order" / IntNumber) & getOrPut & extractMethod) { (id, m) =>
- complete(s"Received ${m.name} request for order $id")
- }
+ val route = (path("order" / IntNumber) & getOrPut & extractMethod) { (id, m) =>
+ complete(s"Received ${m.name} request for order $id")
+ }
verify(route) // #hide
// #example-6
}
diff --git a/docs/src/test/scala/docs/http/scaladsl/server/directives/HeaderDirectivesExamplesSpec.scala b/docs/src/test/scala/docs/http/scaladsl/server/directives/HeaderDirectivesExamplesSpec.scala
index 25330df0f..3235acc33 100644
--- a/docs/src/test/scala/docs/http/scaladsl/server/directives/HeaderDirectivesExamplesSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/server/directives/HeaderDirectivesExamplesSpec.scala
@@ -71,10 +71,9 @@ class HeaderDirectivesExamplesSpec extends RoutingSpec with CompileOnlySpec with
case _ => None
}
- val route =
- (headerValue(extractExampleHeader) | provide("newValue")) { value =>
- complete(s"headerValue $value")
- }
+ val route = (headerValue(extractExampleHeader) | provide("newValue")) { value =>
+ complete(s"headerValue $value")
+ }
// tests:
Get("/") ~> RawHeader("exampleHeaderValue", "theHeaderValue") ~> route ~> check {
diff --git a/docs/src/test/scala/docs/http/scaladsl/server/directives/ParameterDirectivesExamplesSpec.scala b/docs/src/test/scala/docs/http/scaladsl/server/directives/ParameterDirectivesExamplesSpec.scala
index 01e172d57..92c7d44ae 100755
--- a/docs/src/test/scala/docs/http/scaladsl/server/directives/ParameterDirectivesExamplesSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/server/directives/ParameterDirectivesExamplesSpec.scala
@@ -121,7 +121,8 @@ class ParameterDirectivesExamplesSpec extends RoutingSpec with CompileOnlySpec w
Get("/?color=blue&count=blub") ~> Route.seal(route) ~> check {
status shouldEqual StatusCodes.BadRequest
- responseAs[String] shouldEqual "The query parameter 'count' was malformed:\n'blub'" +
+ responseAs[String] shouldEqual
+ "The query parameter 'count' was malformed:\n'blub'" +
" is not a valid 32-bit signed integer value"
}
// #mapped-value
diff --git a/docs/src/test/scala/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala b/docs/src/test/scala/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
index 1d24e6fef..e444e0889 100644
--- a/docs/src/test/scala/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
+++ b/docs/src/test/scala/docs/http/scaladsl/server/directives/RouteDirectivesExamplesSpec.scala
@@ -162,7 +162,8 @@ class RouteDirectivesExamplesSpec extends RoutingSpec with CompileOnlySpec {
Get("/foo") ~> route ~> check {
status shouldEqual StatusCodes.PermanentRedirect
- responseAs[String] shouldEqual """The request, and all future requests should be repeated using this URI."""
+ responseAs[String] shouldEqual
+ """The request, and all future requests should be repeated using this URI."""
}
// #redirect-examples
}
diff --git a/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/MessageToFrameRendererBenchmark.scala b/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/MessageToFrameRendererBenchmark.scala
index 8490803eb..0e6feeb48 100644
--- a/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/MessageToFrameRendererBenchmark.scala
+++ b/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/MessageToFrameRendererBenchmark.scala
@@ -23,14 +23,7 @@ import scala.concurrent.Await
import scala.concurrent.duration.{ Duration, DurationInt }
import org.openjdk.jmh.annotations.{
- Benchmark,
- BenchmarkMode,
- Mode,
- OperationsPerInvocation,
- OutputTimeUnit,
- Scope,
- State,
- TearDown
+ Benchmark, BenchmarkMode, Mode, OperationsPerInvocation, OutputTimeUnit, Scope, State, TearDown
}
import org.apache.pekko
diff --git a/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/http2/H2RequestResponseBenchmark.scala b/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/http2/H2RequestResponseBenchmark.scala
index 989719210..14487abc3 100644
--- a/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/http2/H2RequestResponseBenchmark.scala
+++ b/http-bench-jmh/src/main/scala/org/apache/pekko/http/impl/engine/http2/H2RequestResponseBenchmark.scala
@@ -19,13 +19,7 @@ import org.apache.pekko
import pekko.http.impl.engine.http2.FrameEvent.{ DataFrame, HeadersFrame }
import pekko.http.impl.engine.http2.framing.FrameRenderer
import pekko.http.scaladsl.model.{
- AttributeKeys,
- ContentTypes,
- HttpEntity,
- HttpMethods,
- HttpRequest,
- HttpResponse,
- Trailer
+ AttributeKeys, ContentTypes, HttpEntity, HttpMethods, HttpRequest, HttpResponse, Trailer
}
import pekko.http.scaladsl.model.HttpEntity.{ Chunk, LastChunk }
import pekko.http.scaladsl.model.headers.RawHeader
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/PoolMasterActor.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/PoolMasterActor.scala
index 86e4e6729..fc599e9ec 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/PoolMasterActor.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/PoolMasterActor.scala
@@ -16,13 +16,7 @@ package org.apache.pekko.http.impl.engine.client
import org.apache.pekko
import pekko.Done
import pekko.actor.{
- Actor,
- ActorLogging,
- ActorRef,
- DeadLetterSuppression,
- Deploy,
- ExtendedActorSystem,
- NoSerializationVerificationNeeded,
+ Actor, ActorLogging, ActorRef, DeadLetterSuppression, Deploy, ExtendedActorSystem, NoSerializationVerificationNeeded,
Props
}
import pekko.annotation.InternalApi
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/pool/NewHostConnectionPool.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/pool/NewHostConnectionPool.scala
index 3b776ea34..d5d4a052a 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/pool/NewHostConnectionPool.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/client/pool/NewHostConnectionPool.scala
@@ -313,7 +313,8 @@ private[client] object NewHostConnectionPool {
state = Unconnected
}
- if (!previousState.isIdle && state.isIdle && !(state == Unconnected && currentEmbargo != Duration.Zero)) {
+ if (!previousState.isIdle && state.isIdle &&
+ !(state == Unconnected && currentEmbargo != Duration.Zero)) {
debug("Slot became idle... Trying to pull")
idleSlots.add(this)
pullIfNeeded()
@@ -345,7 +346,8 @@ private[client] object NewHostConnectionPool {
OptionVal.Some(Event.onNewConnectionEmbargo.preApply(currentEmbargo))
// numConnectedSlots might be slow for big numbers of connections, so avoid calling if minConnections feature is disabled
case s
- if !s.isConnected && s.isIdle && settings.minConnections > 0 && numConnectedSlots < settings.minConnections =>
+ if !s.isConnected && s.isIdle && settings.minConnections > 0 &&
+ numConnectedSlots < settings.minConnections =>
debug(s"Preconnecting because number of connected slots fell down to $numConnectedSlots")
OptionVal.Some(Event.onPreConnect)
case _ => OptionVal.None
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
index 2cdb6a42c..a4ff5255c 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala
@@ -15,21 +15,13 @@ package org.apache.pekko.http.impl.engine.http2
import org.apache.pekko
import pekko.actor.{
- ActorSystem,
- ClassicActorSystemProvider,
- ExtendedActorSystem,
- Extension,
- ExtensionId,
- ExtensionIdProvider
+ ActorSystem, ClassicActorSystemProvider, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider
}
import pekko.annotation.InternalApi
import pekko.event.LoggingAdapter
import pekko.http.impl.engine.HttpConnectionIdleTimeoutBidi
import pekko.http.impl.engine.server.{
- GracefulTerminatorStage,
- MasterServerTerminator,
- ServerTerminator,
- UpgradeToOtherProtocolResponseHeader
+ GracefulTerminatorStage, MasterServerTerminator, ServerTerminator, UpgradeToOtherProtocolResponseHeader
}
import pekko.http.impl.util.LogByteStringTools
import pekko.http.scaladsl.Http.OutgoingConnection
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
index 3b14c0b86..2a86ded7d 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala
@@ -29,11 +29,7 @@ import pekko.http.impl.util.LogByteStringTools.logTLSBidiBySetting
import pekko.http.impl.util.StreamUtils
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.settings.{
- ClientConnectionSettings,
- Http2ClientSettings,
- Http2ServerSettings,
- ParserSettings,
- ServerSettings
+ ClientConnectionSettings, Http2ClientSettings, Http2ServerSettings, ParserSettings, ServerSettings
}
import pekko.stream.{ BidiShape, Graph, StreamTcpException, ThrottleMode }
import pekko.stream.TLSProtocol._
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
index 2ad364dd3..8cad00855 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala
@@ -34,12 +34,7 @@ import pekko.stream.Inlet
import pekko.stream.Outlet
import pekko.stream.scaladsl.Source
import pekko.stream.stage.{
- GraphStageLogic,
- GraphStageWithMaterializedValue,
- InHandler,
- OutHandler,
- StageLogging,
- TimerGraphStageLogic
+ GraphStageLogic, GraphStageWithMaterializedValue, InHandler, OutHandler, StageLogging, TimerGraphStageLogic
}
import pekko.util.ByteString
import pekko.util.OptionVal
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
index e4ffb25ac..a09f4ef64 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
@@ -194,7 +194,8 @@ private[http2] trait Http2StreamHandling extends GraphStageLogic with LogHelper
}
debug(
- s"Incoming side of stream [$streamId] changed state: ${oldState.stateName} -> ${newState.stateName} after handling [$event${if (eventArg ne null)
+ s"Incoming side of stream [$streamId] changed state: ${oldState.stateName} -> ${newState.stateName} after handling [$event${if (eventArg ne
+ null)
s"($eventArg)"
else ""}]")
@@ -794,7 +795,8 @@ private[http2] trait Http2StreamHandling extends GraphStageLogic with LogHelper
// TODO: Check that buffer is not too much over the limit (which we might warn the user about)
// The problem here is that backpressure will only work properly if batch elements like
// ByteString have a reasonable size.
- if (!upstreamClosed && buffer.length < multiplexer.maxBytesToBufferPerSubstream && !inlet.hasBeenPulled && !inlet.isClosed)
+ if (!upstreamClosed && buffer.length < multiplexer.maxBytesToBufferPerSubstream && !inlet.hasBeenPulled &&
+ !inlet.isClosed)
inlet.pull()
/** Cleans up internal state (but not external) */
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/BodyPartParser.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/BodyPartParser.scala
index 327810f56..4bbd4f244 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/BodyPartParser.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/BodyPartParser.scala
@@ -335,8 +335,8 @@ private[http] object BodyPartParser {
val boyerMoore: BoyerMoore = new BoyerMoore(needle)
def isBoundary(input: ByteString, offset: Int, ix: Int = eolLength): Boolean = {
- @tailrec def process(input: ByteString, offset: Int, ix: Int): Boolean =
- (ix == needle.length) || (byteAt(input, offset + ix - eol.length) == needle(ix)) && process(input, offset,
+ @tailrec def process(input: ByteString, offset: Int, ix: Int): Boolean = (ix == needle.length) ||
+ (byteAt(input, offset + ix - eol.length) == needle(ix)) && process(input, offset,
ix + 1)
process(input, offset, ix)
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParser.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParser.scala
index 7bfc0dc25..a5d8b9468 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParser.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParser.scala
@@ -28,9 +28,7 @@ import pekko.http.impl.util.HttpConstants._
import pekko.http.scaladsl.model.{ ErrorInfo, HttpHeader, MediaTypes, StatusCode, StatusCodes }
import pekko.http.scaladsl.model.headers.{ EmptyHeader, RawHeader }
import pekko.http.scaladsl.settings.ParserSettings.{
- ErrorLoggingVerbosity,
- IllegalResponseHeaderNameProcessingMode,
- IllegalResponseHeaderValueProcessingMode
+ ErrorLoggingVerbosity, IllegalResponseHeaderNameProcessingMode, IllegalResponseHeaderValueProcessingMode
}
import pekko.util.ByteString
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/rendering/HttpResponseRendererFactory.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/rendering/HttpResponseRendererFactory.scala
index 1a4b58e0d..56f1570e7 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/rendering/HttpResponseRendererFactory.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/rendering/HttpResponseRendererFactory.scala
@@ -159,7 +159,8 @@ private[http] class HttpResponseRendererFactory(
def render(h: HttpHeader) = r ~~ h
def mustRenderTransferEncodingChunkedHeader =
- entity.isChunked && (!entity.isKnownEmpty || ctx.requestMethod == HttpMethods.HEAD) && (ctx.requestProtocol == `HTTP/1.1`)
+ entity.isChunked && (!entity.isKnownEmpty || ctx.requestMethod == HttpMethods.HEAD) &&
+ (ctx.requestProtocol == `HTTP/1.1`)
def renderHeaders(headers: immutable.Seq[HttpHeader], alwaysClose: Boolean = false): Unit = {
var connHeader: Connection = null
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/server/HttpServerBluePrint.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/server/HttpServerBluePrint.scala
index 80fc48985..9105a37db 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/server/HttpServerBluePrint.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/server/HttpServerBluePrint.scala
@@ -32,10 +32,7 @@ import pekko.http.impl.engine.parsing.ParserOutput._
import pekko.http.impl.engine.parsing._
import pekko.http.impl.engine.rendering.ResponseRenderingContext.CloseRequested
import pekko.http.impl.engine.rendering.{
- DateHeaderRendering,
- HttpResponseRendererFactory,
- ResponseRenderingContext,
- ResponseRenderingOutput
+ DateHeaderRendering, HttpResponseRendererFactory, ResponseRenderingContext, ResponseRenderingOutput
}
import pekko.http.impl.util._
import pekko.http.javadsl.model
@@ -513,8 +510,7 @@ private[http] object HttpServerBluePrint {
s"Sending an 2xx 'early' response before end of request for ${requestStart.uri} received... " +
"Note that the connection will be closed after this response. Also, many clients will not read early responses! " +
"Consider only issuing this response after the request data has been completely read!")
- val forceClose =
- (requestStart.expect100Continue && oneHundredContinueResponsePending) ||
+ val forceClose = (requestStart.expect100Continue && oneHundredContinueResponsePending) ||
(isClosed(requestParsingIn) && openRequests.isEmpty) ||
isEarlyResponse
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/Protocol.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/Protocol.scala
index 8e48eb190..34f150fe0 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/Protocol.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/Protocol.scala
@@ -74,8 +74,10 @@ private[http] object Protocol {
def isError(code: Int): Boolean = !(code == Regular || code == GoingAway)
def isValid(code: Int): Boolean =
((code >= 1000) && (code <= 1003)) ||
- (code >= 1007) && (code <= 1011) ||
- (code >= 3000) && (code <= 4999)
+ (code >= 1007) &&
+ (code <= 1011) ||
+ (code >= 3000) &&
+ (code <= 4999)
val Regular = 1000
val GoingAway = 1001
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/AcceptHeader.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/AcceptHeader.scala
index d53300ee9..c38f79aa2 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/AcceptHeader.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/AcceptHeader.scala
@@ -48,6 +48,7 @@ private[parser] trait AcceptHeader { this: Parser with CommonRules with CommonAc
def `media-range-def` = rule {
"*/*" ~ push("*") ~ push("*") |
'*' ~ push("*") ~ push("*") |
- `type` ~ '/' ~ ('*' ~ !tchar ~ push("*") | subtype)
+ `type` ~ '/' ~
+ ('*' ~ !tchar ~ push("*") | subtype)
}
}
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CacheControlHeader.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CacheControlHeader.scala
index d7aec80ae..e4902e7b6 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CacheControlHeader.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CacheControlHeader.scala
@@ -27,18 +27,25 @@ private[parser] trait CacheControlHeader { this: HeaderParser =>
def `cache-directive` = rule(
"no-store" ~ push(`no-store`)
| "no-transform" ~ push(`no-transform`)
- | "max-age=" ~ `delta-seconds` ~> (`max-age`(_))
- | "max-stale" ~ optional(ws('=') ~ `delta-seconds`) ~> (`max-stale`(_))
- | "min-fresh=" ~ `delta-seconds` ~> (`min-fresh`(_))
+ | "max-age=" ~ `delta-seconds` ~>
+ (`max-age`(_))
+ | "max-stale" ~ optional(ws('=') ~ `delta-seconds`) ~>
+ (`max-stale`(_))
+ | "min-fresh=" ~ `delta-seconds` ~>
+ (`min-fresh`(_))
| "only-if-cached" ~ push(`only-if-cached`)
| "public" ~ push(`public`)
- | "private" ~ (ws('=') ~ `field-names` ~> (`private`(_)) | push(`private`()))
- | "no-cache" ~ (ws('=') ~ `field-names` ~> (`no-cache`(_)) | push(`no-cache`))
+ | "private" ~
+ (ws('=') ~ `field-names` ~> (`private`(_)) | push(`private`()))
+ | "no-cache" ~
+ (ws('=') ~ `field-names` ~> (`no-cache`(_)) | push(`no-cache`))
| "must-revalidate" ~ push(`must-revalidate`)
| "proxy-revalidate" ~ push(`proxy-revalidate`)
- | "s-maxage=" ~ `delta-seconds` ~> (`s-maxage`(_))
+ | "s-maxage=" ~ `delta-seconds` ~>
+ (`s-maxage`(_))
| "immutable" ~ push(immutableDirective)
- | token ~ optional(ws('=') ~ word) ~> (CacheDirective.custom(_, _)))
+ | token ~ optional(ws('=') ~ word) ~>
+ (CacheDirective.custom(_, _)))
def `field-names` = rule { `quoted-tokens` | token ~> (List(_)) }
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CommonRules.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CommonRules.scala
index 3633c2a83..6b4b7df60 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CommonRules.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/CommonRules.scala
@@ -71,7 +71,8 @@ private[parser] trait CommonRules extends StringBuilding { this: Parser =>
else {
var saved: String = null
rule {
- &('(') ~ run { saved = sb.toString } ~ (comment(maxNesting - 1) ~ prependSB(saved + " (") ~ appendSB(
+ &('(') ~ run { saved = sb.toString } ~
+ (comment(maxNesting - 1) ~ prependSB(saved + " (") ~ appendSB(
')') | setSB(saved) ~ test(false))
}
}
@@ -104,7 +105,9 @@ private[parser] trait CommonRules extends StringBuilding { this: Parser =>
}
def `day-name` = rule(
- "Sun" ~ push(0) | "Mon" ~ push(1) | "Tue" ~ push(2) | "Wed" ~ push(3) | "Thu" ~ push(4) | "Fri" ~ push(
+ "Sun" ~ push(0) | "Mon" ~ push(1) | "Tue" ~ push(2) | "Wed" ~ push(3) | "Thu" ~ push(4) |
+ "Fri" ~
+ push(
5) | "Sat" ~ push(6))
def date1 = rule { day ~ `date-sep` ~ month ~ `date-sep` ~ year }
@@ -112,7 +115,9 @@ private[parser] trait CommonRules extends StringBuilding { this: Parser =>
def day = rule { digit2 | digit }
def month = rule(
- "Jan" ~ push(1) | "Feb" ~ push(2) | "Mar" ~ push(3) | "Apr" ~ push(4) | "May" ~ push(5) | "Jun" ~ push(
+ "Jan" ~ push(1) | "Feb" ~ push(2) | "Mar" ~ push(3) | "Apr" ~ push(4) | "May" ~ push(5) |
+ "Jun" ~
+ push(
6) | "Jul" ~ push(7) |
"Aug" ~ push(8) | "Sep" ~ push(9) | "Oct" ~ push(10) | "Nov" ~ push(11) | "Dec" ~ push(12))
@@ -248,7 +253,8 @@ private[parser] trait CommonRules extends StringBuilding { this: Parser =>
}
def `generic-credentials` = rule {
- `challenge-or-credentials` ~> ((scheme, tokenAndParams) => {
+ `challenge-or-credentials` ~>
+ ((scheme, tokenAndParams) => {
val (token, params) = tokenAndParams
GenericHttpCredentials(scheme, token, TreeMap(params: _*))
})
@@ -286,7 +292,8 @@ private[parser] trait CommonRules extends StringBuilding { this: Parser =>
}
def `cookie-av` = rule {
- `expires-av` | `max-age-av` | `domain-av` | `path-av` | `same-site-av` | `secure-av` | `httponly-av` | `extension-av`
+ `expires-av` | `max-age-av` | `domain-av` | `path-av` | `same-site-av` | `secure-av` | `httponly-av` |
+ `extension-av`
}
def `expires-av` = rule {
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/HeaderParser.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/HeaderParser.scala
index e82c6aafc..9a611aa72 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/HeaderParser.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/HeaderParser.scala
@@ -18,8 +18,7 @@ import pekko.annotation.InternalApi
import pekko.http.scaladsl.settings.ParserSettings
import pekko.http.scaladsl.settings.ParserSettings.CookieParsingMode
import pekko.http.scaladsl.settings.ParserSettings.{
- IllegalResponseHeaderNameProcessingMode,
- IllegalResponseHeaderValueProcessingMode
+ IllegalResponseHeaderNameProcessingMode, IllegalResponseHeaderValueProcessingMode
}
import pekko.http.scaladsl.model.headers.HttpCookiePair
import pekko.util.ConstantFun
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/SimpleHeaders.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/SimpleHeaders.scala
index 0522a774b..aa58c3cc0 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/SimpleHeaders.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/SimpleHeaders.scala
@@ -30,7 +30,8 @@ private[parser] trait SimpleHeaders {
// http://tools.ietf.org/html/rfc7233#section-2.3
def `accept-ranges` = rule {
- ("none" ~ push(Nil) | zeroOrMore(ws(',')) ~ oneOrMore(`range-unit`).separatedBy(listSep)) ~ EOI ~> (`Accept-Ranges`(
+ ("none" ~ push(Nil) | zeroOrMore(ws(',')) ~ oneOrMore(`range-unit`).separatedBy(listSep)) ~ EOI ~>
+ (`Accept-Ranges`(
_))
}
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/UriParser.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/UriParser.scala
index 7d9e1c4ba..98d914f83 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/UriParser.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/UriParser.scala
@@ -203,8 +203,10 @@ private[http] final class UriParser(
| `path-empty`)
def scheme = rule(
- 'h' ~ 't' ~ 't' ~ 'p' ~ (&(':') ~ run(setScheme("http")) | 's' ~ &(':') ~ run(setScheme("https")))
- | clearSB() ~ ALPHA ~ appendLowered() ~ zeroOrMore(`scheme-char` ~ appendLowered()) ~ &(':') ~ run(
+ 'h' ~ 't' ~ 't' ~ 'p' ~
+ (&(':') ~ run(setScheme("http")) | 's' ~ &(':') ~ run(setScheme("https")))
+ | clearSB() ~ ALPHA ~ appendLowered() ~ zeroOrMore(`scheme-char` ~ appendLowered()) ~ &(':') ~
+ run(
setScheme(sb.toString)))
def `scheme-pushed` =
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/settings/ParserSettingsImpl.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/settings/ParserSettingsImpl.scala
index f6958dc0f..08079cae7 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/settings/ParserSettingsImpl.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/settings/ParserSettingsImpl.scala
@@ -18,11 +18,8 @@ import org.apache.pekko
import pekko.annotation.InternalApi
import pekko.http.impl.util._
import pekko.http.scaladsl.settings.ParserSettings.{
- ConflictingContentTypeHeaderProcessingMode,
- CookieParsingMode,
- ErrorLoggingVerbosity,
- IllegalResponseHeaderNameProcessingMode,
- IllegalResponseHeaderValueProcessingMode
+ ConflictingContentTypeHeaderProcessingMode, CookieParsingMode, ErrorLoggingVerbosity,
+ IllegalResponseHeaderNameProcessingMode, IllegalResponseHeaderValueProcessingMode
}
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.settings.ParserSettings
diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/util/JavaMapping.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/util/JavaMapping.scala
index 4235cca31..fdce20b52 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/impl/util/JavaMapping.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/impl/util/JavaMapping.scala
@@ -26,11 +26,7 @@ import pekko.NotUsed
import pekko.annotation.InternalApi
import pekko.http.impl.model.{ JavaQuery, JavaUri }
import pekko.http.javadsl.{
- model => jm,
- settings => js,
- ConnectionContext,
- HttpConnectionContext,
- HttpsConnectionContext
+ model => jm, settings => js, ConnectionContext, HttpConnectionContext, HttpsConnectionContext
}
import pekko.http.{ javadsl => jdsl, scaladsl => sdsl }
import pekko.http.scaladsl.{ model => sm }
diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/DateTime.scala b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/DateTime.scala
index e5badd9f0..3e031f540 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/DateTime.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/DateTime.scala
@@ -118,7 +118,7 @@ final case class DateTime private (
*/
def renderRfc1123DateTimeString[R <: Rendering](r: R): r.type =
put_##(put_##(put_##(put_##(r ~~ weekdayStr ~~ ',' ~~ ' ', day) ~~ ' ' ~~ monthStr ~~ ' ' ~~ year ~~ ' ',
- hour) ~~ ':', minute) ~~ ':', second) ~~ " GMT"
+ hour) ~~ ':', minute) ~~ ':', second) ~~ " GMT"
/**
* RFC1123 date string, e.g. `Sun, 06 Nov 1994 08:49:37 GMT`
@@ -246,12 +246,11 @@ object DateTime {
isLeapYear = isLeap)
}
- private def isLeapYear(year: Int): Boolean =
- ((year & 0x03) == 0) && {
- val q = year / 100
- val r = year % 100
- r != 0 || (q & 0x03) == 0
- }
+ private def isLeapYear(year: Int): Boolean = ((year & 0x03) == 0) && {
+ val q = year / 100
+ val r = year % 100
+ r != 0 || (q & 0x03) == 0
+ }
/**
* Creates a new `DateTime` instance for the current point in time.
diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/ErrorInfo.scala b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/ErrorInfo.scala
index 5d73947b5..7fb70b011 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/ErrorInfo.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/ErrorInfo.scala
@@ -42,7 +42,8 @@ final class ErrorInfo(
override def equals(that: Any): Boolean = that match {
case that: ErrorInfo => that.canEqual(
- this) && that.summary == this.summary && that.detail == this.detail && that.errorHeaderName == this.errorHeaderName
+ this) && that.summary == this.summary && that.detail == this.detail &&
+ that.errorHeaderName == this.errorHeaderName
case _ => false
}
diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/MediaRange.scala b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/MediaRange.scala
index f4b12ab21..2352d3a81 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/MediaRange.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/MediaRange.scala
@@ -61,7 +61,8 @@ sealed abstract class MediaRange extends jm.MediaRange with Renderable with With
object MediaRange {
private[http] def splitOffQValue(params: Map[String, String], defaultQ: Float = 1.0f): (Map[String, String], Float) =
params.get("q") match {
- case Some(x) => (params - "q") -> (try x.toFloat
+ case Some(x) => (params - "q") ->
+ (try x.toFloat
catch { case _: NumberFormatException => 1.0f })
case None => params -> defaultQ
}
diff --git a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/HttpCookie.scala b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/HttpCookie.scala
index a6dd33aed..814776dd1 100644
--- a/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/HttpCookie.scala
+++ b/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/headers/HttpCookie.scala
@@ -243,11 +243,12 @@ sealed trait SameSite extends Renderable {
case SameSite.None => jm.headers.SameSite.None
}
- override private[http] def render[R <: Rendering](r: R): r.type = r ~~ (this match {
- case SameSite.Strict => "Strict"
- case SameSite.Lax => "Lax"
- case SameSite.None => "None"
- })
+ override private[http] def render[R <: Rendering](r: R): r.type = r ~~
+ (this match {
+ case SameSite.Strict => "Strict"
+ case SameSite.Lax => "Lax"
+ case SameSite.None => "None"
+ })
}
object SameSite {
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HostConnectionPoolSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HostConnectionPoolSpec.scala
index cc2697dc4..d931c3034 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HostConnectionPoolSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HostConnectionPoolSpec.scala
@@ -892,7 +892,8 @@ class HostConnectionPoolSpec extends PekkoSpecWithMaterializer(
implicit builder => (resIn, reqOut, client) =>
import GraphDSL.Implicits._
- builder.materializedValue ~> Sink.foreach[
+ builder.materializedValue ~>
+ Sink.foreach[
(Publisher[HttpResponse], Subscriber[HttpRequest], Future[Http.OutgoingConnection])] {
case (resOut, reqIn, clientConn) =>
clientConn.foreach { _ =>
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HttpConfigurationSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HttpConfigurationSpec.scala
index a23cd996b..e6693379a 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HttpConfigurationSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/HttpConfigurationSpec.scala
@@ -16,11 +16,7 @@ package org.apache.pekko.http.impl.engine.client
import org.apache.pekko
import pekko.actor.ActorSystem
import pekko.http.scaladsl.settings.{
- ClientConnectionSettings,
- ConnectionPoolSettings,
- HttpsProxySettings,
- ParserSettings,
- ServerSettings
+ ClientConnectionSettings, ConnectionPoolSettings, HttpsProxySettings, ParserSettings, ServerSettings
}
import pekko.testkit.PekkoSpec
import com.typesafe.config.ConfigFactory
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/LowLevelOutgoingConnectionSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/LowLevelOutgoingConnectionSpec.scala
index 063e8fb11..fe48e6205 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/LowLevelOutgoingConnectionSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/LowLevelOutgoingConnectionSpec.scala
@@ -509,7 +509,8 @@ class LowLevelOutgoingConnectionSpec extends PekkoSpecWithMaterializer with Insi
sub.sendComplete()
val InvalidContentLengthException(info) = netOut.expectError()
- info.summary shouldEqual "HTTP message had declared Content-Length 8 but entity data stream amounts to 2 bytes less"
+ info.summary shouldEqual
+ "HTTP message had declared Content-Length 8 but entity data stream amounts to 2 bytes less"
netInSub.sendComplete()
responsesSub.request(1)
responses.expectError().getMessage should equal(
@@ -537,7 +538,8 @@ class LowLevelOutgoingConnectionSpec extends PekkoSpecWithMaterializer with Insi
sub.sendNext(ByteString("XYZ"))
val InvalidContentLengthException(info) = netOut.expectError()
- info.summary shouldEqual "HTTP message had declared Content-Length 8 but entity data stream amounts to more bytes"
+ info.summary shouldEqual
+ "HTTP message had declared Content-Length 8 but entity data stream amounts to more bytes"
netInSub.sendComplete()
responsesSub.request(1)
responses.expectError().getMessage should equal(
@@ -553,7 +555,8 @@ class LowLevelOutgoingConnectionSpec extends PekkoSpecWithMaterializer with Insi
responsesSub.request(1)
val error @ IllegalResponseException(info) = responses.expectError()
- info.formatPretty shouldEqual "The server-side protocol or HTTP version is not supported: start of response: [48 54 54 50 2F 31 2E 32 20 32 30 30 20 4F 4B 0D | HTTP/1.2 200 OK.]"
+ info.formatPretty shouldEqual
+ "The server-side protocol or HTTP version is not supported: start of response: [48 54 54 50 2F 31 2E 32 20 32 30 30 20 4F 4B 0D | HTTP/1.2 200 OK.]"
netOut.expectError(error)
requestsSub.expectCancellation()
netInSub.expectCancellation()
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
index 9ce4f32c4..0ba979a7a 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/NewConnectionPoolSpec.scala
@@ -26,11 +26,7 @@ import pekko.http.impl.engine.server.ServerTerminator
import pekko.http.impl.engine.ws.ByteStringSinkProbe
import pekko.http.impl.util._
import pekko.http.scaladsl.Http.{
- HostConnectionPool,
- HostConnectionPoolImpl,
- HttpServerTerminated,
- HttpTerminated,
- OutgoingConnection
+ HostConnectionPool, HostConnectionPoolImpl, HttpServerTerminated, HttpTerminated, OutgoingConnection
}
import pekko.http.scaladsl.model.HttpEntity.{ Chunk, ChunkStreamPart, Chunked, LastChunk }
import pekko.http.scaladsl.model.{ HttpEntity, _ }
@@ -349,7 +345,8 @@ class NewConnectionPoolSpec extends PekkoSpecWithMaterializer("""
Await.result(gateway.poolStatus(), 1500.millis.dilated).get shouldBe a[PoolInterfaceRunning]
awaitCond({ Await.result(gateway.poolStatus(), 1500.millis.dilated).isEmpty }, 2000.millis.dilated)
}
- "automatically shutdown after configured timeout periods but only after streaming response is finished" in new TestSetup() {
+ "automatically shutdown after configured timeout periods but only after streaming response is finished" in
+ new TestSetup() {
val (requestIn, responseOut, responseOutSub, hcp) = cachedHostConnectionPool[Int](idleTimeout = 200.millis)
val gateway = hcp.poolId
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/PrepareResponseSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/PrepareResponseSpec.scala
index 614298a8e..243201596 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/PrepareResponseSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/client/PrepareResponseSpec.scala
@@ -17,10 +17,7 @@ import org.apache.pekko
import pekko.http.impl.engine.client.OutgoingConnectionBlueprint.PrepareResponse
import pekko.http.impl.engine.parsing.ParserOutput
import pekko.http.impl.engine.parsing.ParserOutput.{
- EntityChunk,
- EntityStreamError,
- StreamedEntityCreator,
- StrictEntityCreator
+ EntityChunk, EntityStreamError, StreamedEntityCreator, StrictEntityCreator
}
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.settings.ParserSettings
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParserSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParserSpec.scala
index 04ef111f4..c637ff296 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParserSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/HttpHeaderParserSpec.scala
@@ -28,8 +28,7 @@ import pekko.http.scaladsl.model.headers._
import pekko.http.impl.model.parser.CharacterClasses
import pekko.http.impl.util._
import pekko.http.scaladsl.settings.ParserSettings.{
- IllegalResponseHeaderNameProcessingMode,
- IllegalResponseHeaderValueProcessingMode
+ IllegalResponseHeaderNameProcessingMode, IllegalResponseHeaderValueProcessingMode
}
import pekko.testkit.EventFilter
@@ -195,7 +194,8 @@ abstract class HttpHeaderParserSpec(mode: String, newLine: String) extends Pekko
RawHeader("4-UTF8-Bytes", "Surrogate pairs: \uD801\uDC1B\uD801\uDC04\uD801\uDC1B!")
}
- "parse multiple header lines subsequently with UTF-8 characters one after another without crashing" in new TestSetup {
+ "parse multiple header lines subsequently with UTF-8 characters one after another without crashing" in
+ new TestSetup {
parseLine(s"""Content-Disposition: form-data; name="test"; filename="λ"${newLine}x""")
// The failing parsing line is one that must share a prefix with the utf-8 line up to the non-ascii char. The next character
// doesn't even have to be a non-ascii char.
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/RequestParserSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/RequestParserSpec.scala
index f640b13af..d2dcf9e26 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/RequestParserSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/RequestParserSpec.scala
@@ -176,7 +176,8 @@ abstract class RequestParserSpec(mode: String, newLine: String) extends AnyFreeS
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = first" in new Test {
+ "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = first" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.First)
@@ -191,7 +192,8 @@ abstract class RequestParserSpec(mode: String, newLine: String) extends AnyFreeS
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = last" in new Test {
+ "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = last" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.Last)
@@ -206,7 +208,8 @@ abstract class RequestParserSpec(mode: String, newLine: String) extends AnyFreeS
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = no-content-type" in new Test {
+ "with several conflicting `Content-Type` headers with conflicting-content-type-header-processing-mode = no-content-type" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.NoContentType)
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/ResponseParserSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/ResponseParserSpec.scala
index 9cfee9e1e..470ba6a2d 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/ResponseParserSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/parsing/ResponseParserSpec.scala
@@ -142,7 +142,8 @@ abstract class ResponseParserSpec(mode: String, newLine: String) extends PekkoSp
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = first" in new Test {
+ "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = first" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.First)
@@ -156,7 +157,8 @@ abstract class ResponseParserSpec(mode: String, newLine: String) extends PekkoSp
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = last" in new Test {
+ "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = last" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.Last)
@@ -170,7 +172,8 @@ abstract class ResponseParserSpec(mode: String, newLine: String) extends PekkoSp
closeAfterResponseCompletion shouldEqual Seq(false)
}
- "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = no-content-type" in new Test {
+ "a response with several conflicting Content-Type headers with conflicting-content-type-header-processing-mode = no-content-type" in
+ new Test {
override def parserSettings: ParserSettings =
super.parserSettings.withConflictingContentTypeHeaderProcessingMode(
ConflictingContentTypeHeaderProcessingMode.NoContentType)
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/rendering/ResponseRendererSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/rendering/ResponseRendererSpec.scala
index c3bfb4756..10e08f97a 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/rendering/ResponseRendererSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/rendering/ResponseRendererSpec.scala
@@ -158,7 +158,8 @@ class ResponseRendererSpec extends AnyFreeSpec with Matchers with BeforeAndAfter
|""", close = false)
}
- "to a HEAD request setting a custom Content-Type and Content-Length (default response entity)" in new TestSetup() {
+ "to a HEAD request setting a custom Content-Type and Content-Length (default response entity)" in
+ new TestSetup() {
ResponseRenderingContext(
requestMethod = HttpMethods.HEAD,
response = HttpResponse(
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerBug21008Spec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerBug21008Spec.scala
index d3f9b50e8..98c20d720 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerBug21008Spec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerBug21008Spec.scala
@@ -34,7 +34,8 @@ class HttpServerBug21008Spec extends PekkoSpecWithMaterializer(
pekko.test.filter-leeway=1s""") with Inside { spec =>
"The HttpServer" should {
- "not cause internal graph failures when consuming a `100 Continue` entity triggers a failure" in assertAllStagesStopped(
+ "not cause internal graph failures when consuming a `100 Continue` entity triggers a failure" in
+ assertAllStagesStopped(
new HttpServerTestSetupBase {
override implicit def system: ActorSystem = HttpServerBug21008Spec.this.system
override implicit def materializer: Materializer = HttpServerBug21008Spec.this.materializer
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerSpec.scala
index ea30afcf0..6d73f2967 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/HttpServerSpec.scala
@@ -158,7 +158,8 @@ class HttpServerSpec extends PekkoSpec(
netIn.sendComplete()
})
- "deliver the request entity as it comes in strictly for an immediately completed Strict entity" in assertAllStagesStopped(
+ "deliver the request entity as it comes in strictly for an immediately completed Strict entity" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST /strict HTTP/1.1
|Host: example.com
@@ -434,7 +435,8 @@ class HttpServerSpec extends PekkoSpec(
shutdownBlueprint()
})
- "report a truncated entity stream on the entity data stream and the main stream for a Default entity" in assertAllStagesStopped(
+ "report a truncated entity stream on the entity data stream and the main stream for a Default entity" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -450,12 +452,14 @@ class HttpServerSpec extends PekkoSpec(
dataProbe.expectNext(ByteString("abcdef"))
dataProbe.expectNoMessage(50.millis)
closeNetworkInput()
- dataProbe.expectError().getMessage shouldEqual "Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly."
+ dataProbe.expectError().getMessage shouldEqual
+ "Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly."
}
shutdownBlueprint()
})
- "report a truncated entity stream on the entity data stream and the main stream for a Chunked entity" in assertAllStagesStopped(
+ "report a truncated entity stream on the entity data stream and the main stream for a Chunked entity" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -473,7 +477,8 @@ class HttpServerSpec extends PekkoSpec(
dataProbe.expectNext(Chunk(ByteString("abcdef")))
dataProbe.expectNoMessage(50.millis)
closeNetworkInput()
- dataProbe.expectError().getMessage shouldEqual "Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly."
+ dataProbe.expectError().getMessage shouldEqual
+ "Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly."
}
shutdownBlueprint()
})
@@ -501,7 +506,8 @@ class HttpServerSpec extends PekkoSpec(
shutdownBlueprint()
})
- "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Strict)" in assertAllStagesStopped(
+ "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Strict)" in
+ assertAllStagesStopped(
new TestSetup {
override def settings = super.settings.withTransparentHeadRequests(true)
send("""HEAD / HTTP/1.1
@@ -526,7 +532,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Default)" in assertAllStagesStopped(
+ "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Default)" in
+ assertAllStagesStopped(
new TestSetup {
override def settings = super.settings.withTransparentHeadRequests(true)
send("""HEAD / HTTP/1.1
@@ -554,7 +561,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with CloseDelimited)" in assertAllStagesStopped(
+ "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with CloseDelimited)" in
+ assertAllStagesStopped(
new TestSetup {
override def settings = super.settings.withTransparentHeadRequests(true)
send("""HEAD / HTTP/1.1
@@ -583,7 +591,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Chunked)" in assertAllStagesStopped(
+ "not emit entities when responding to HEAD requests if transparent-head-requests is enabled (with Chunked)" in
+ assertAllStagesStopped(
new TestSetup {
override def settings = super.settings.withTransparentHeadRequests(true)
send("""HEAD / HTTP/1.1
@@ -673,7 +682,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "produce a `100 Continue` response when requested by a `Default` entity and some data sent early" in assertAllStagesStopped(
+ "produce a `100 Continue` response when requested by a `Default` entity and some data sent early" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -743,7 +753,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not produce a `100 Continue` response if `Strict` entity is empty because `Content-Length` header is 0" in assertAllStagesStopped(
+ "not produce a `100 Continue` response if `Strict` entity is empty because `Content-Length` header is 0" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -768,7 +779,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not produce a `100 Continue` response if `Strict` entity is empty because `Content-Length` header is missing" in assertAllStagesStopped(
+ "not produce a `100 Continue` response if `Strict` entity is empty because `Content-Length` header is missing" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -866,7 +878,8 @@ class HttpServerSpec extends PekkoSpec(
requests.expectError()
})
- "not fail with 'Cannot pull port (ControllerStage.requestParsingIn) twice' for early response to `100 Continue` request (after 100-Continue has been sent)" in assertAllStagesStopped(
+ "not fail with 'Cannot pull port (ControllerStage.requestParsingIn) twice' for early response to `100 Continue` request (after 100-Continue has been sent)" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -914,7 +927,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "not fail with 'Cannot pull port (ControllerStage.requestParsingIn) twice' for early response to `100 Continue` request (before 100-Continue has been sent)" in assertAllStagesStopped(
+ "not fail with 'Cannot pull port (ControllerStage.requestParsingIn) twice' for early response to `100 Continue` request (before 100-Continue has been sent)" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -1277,7 +1291,8 @@ class HttpServerSpec extends PekkoSpec(
netIn.sendComplete()
})
- "add `Connection: close` to early responses if HttpResponse includes `Connection: keep-alive` header" in assertAllStagesStopped(
+ "add `Connection: close` to early responses if HttpResponse includes `Connection: keep-alive` header" in
+ assertAllStagesStopped(
new TestSetup {
send("""POST / HTTP/1.1
|Host: example.com
@@ -1552,7 +1567,8 @@ class HttpServerSpec extends PekkoSpec(
netOut.expectComplete()
})
- "reject HTTP/1.1 requests with Host header that doesn't match absolute request target authority" in assertAllStagesStopped(
+ "reject HTTP/1.1 requests with Host header that doesn't match absolute request target authority" in
+ assertAllStagesStopped(
new TestSetup {
send("""GET http://www.example.com HTTP/1.1
|Host: www.example.net
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/PrepareRequestsSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/PrepareRequestsSpec.scala
index fd7841dad..5a8b5382f 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/PrepareRequestsSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/server/PrepareRequestsSpec.scala
@@ -16,10 +16,7 @@ package org.apache.pekko.http.impl.engine.server
import org.apache.pekko
import pekko.http.impl.engine.parsing.ParserOutput
import pekko.http.impl.engine.parsing.ParserOutput.{
- EntityChunk,
- EntityStreamError,
- StreamedEntityCreator,
- StrictEntityCreator
+ EntityChunk, EntityStreamError, StreamedEntityCreator, StrictEntityCreator
}
import pekko.http.impl.engine.server.HttpServerBluePrint.PrepareRequests
import pekko.http.scaladsl.model._
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/MessageSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/MessageSpec.scala
index 011daa114..8d2b92072 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/MessageSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/MessageSpec.scala
@@ -476,7 +476,8 @@ class MessageSpec extends PekkoSpecWithMaterializer(
List("ping", "pong").foreach { keepAliveMode =>
def expectedOpcode = if (keepAliveMode == "ping") Opcode.Ping else Opcode.Pong
- s"automatically send keep-alive [$keepAliveMode] frames, with empty data, when configured on the server side" in new ServerTestSetup {
+ s"automatically send keep-alive [$keepAliveMode] frames, with empty data, when configured on the server side" in
+ new ServerTestSetup {
override def websocketSettings: WebSocketSettings = // configures server to do keep-alive
super.websocketSettings
.withPeriodicKeepAliveMode(keepAliveMode)
@@ -486,7 +487,8 @@ class MessageSpec extends PekkoSpecWithMaterializer(
expectFrameOnNetwork(expectedOpcode, ByteString.empty, fin = true)
expectFrameOnNetwork(expectedOpcode, ByteString.empty, fin = true)
}
- s"automatically send keep-alive [$keepAliveMode] frames, with data payload, when configured on the server side" in new ServerTestSetup {
+ s"automatically send keep-alive [$keepAliveMode] frames, with data payload, when configured on the server side" in
+ new ServerTestSetup {
val counter = new AtomicInteger()
override def websocketSettings: WebSocketSettings = // configures server to do keep-alive
super.websocketSettings
@@ -499,7 +501,8 @@ class MessageSpec extends PekkoSpecWithMaterializer(
expectFrameOnNetwork(expectedOpcode, ByteString("ping-3"), fin = true)
}
- s"automatically send keep-alive [$keepAliveMode] frames, with empty data, when configured on the client side" in new ClientTestSetup {
+ s"automatically send keep-alive [$keepAliveMode] frames, with empty data, when configured on the client side" in
+ new ClientTestSetup {
override def websocketSettings: WebSocketSettings = // configures client to do keep-alive
super.websocketSettings
.withPeriodicKeepAliveMode(keepAliveMode)
@@ -509,7 +512,8 @@ class MessageSpec extends PekkoSpecWithMaterializer(
expectFrameOnNetwork(expectedOpcode, ByteString.empty, fin = true)
expectFrameOnNetwork(expectedOpcode, ByteString.empty, fin = true)
}
- s"automatically send keep-alive [$keepAliveMode] frames, with data payload, when configured on the client side" in new ClientTestSetup {
+ s"automatically send keep-alive [$keepAliveMode] frames, with data payload, when configured on the client side" in
+ new ClientTestSetup {
val counter = new AtomicInteger()
override def websocketSettings: WebSocketSettings = // configures client to do keep-alive
super.websocketSettings
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WebSocketIntegrationSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WebSocketIntegrationSpec.scala
index c0b3ee6fa..fc69690b7 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WebSocketIntegrationSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/engine/ws/WebSocketIntegrationSpec.scala
@@ -76,7 +76,8 @@ class WebSocketIntegrationSpec extends PekkoSpecWithMaterializer(
binding.unbind()
}
- "not reset the connection when no data are flowing and the connection is closed from the client" in Utils.assertAllStagesStopped {
+ "not reset the connection when no data are flowing and the connection is closed from the client" in
+ Utils.assertAllStagesStopped {
val source = TestPublisher.probe[Message]()
val bindingFuture = Http().newServerAt("localhost", 0).bindSync {
_.attribute(webSocketUpgrade).get.handleMessages(Flow.fromSinkAndSource(Sink.ignore,
@@ -161,7 +162,8 @@ class WebSocketIntegrationSpec extends PekkoSpecWithMaterializer(
binding.unbind()
}
- "send back 100 elements and then terminate without error even when not ordinarily closed" in Utils.assertAllStagesStopped {
+ "send back 100 elements and then terminate without error even when not ordinarily closed" in
+ Utils.assertAllStagesStopped {
val N = 100
val handler = Flow.fromGraph(GraphDSL.create() { implicit b =>
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/util/CollectionStage.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/util/CollectionStage.scala
index 1f99fc5a6..a1a81031d 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/util/CollectionStage.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/util/CollectionStage.scala
@@ -34,10 +34,9 @@ sealed private[pekko] trait Collect[T] {
@InternalApi private[pekko] object CollectorStage {
def resultAfterSourceElements[T, U](source: Source[T, Any], flow: Flow[T, U, Any])(
implicit materializer: Materializer): Future[(Seq[U], Boolean)] = {
- val collector =
- (source ++ Source.maybe[T] /* Never complete*/ )
- .via(flow)
- .runWith(new CollectorStage[U])
+ val collector = (source ++ Source.maybe[T] /* Never complete*/ )
+ .via(flow)
+ .runWith(new CollectorStage[U])
collector.collectAndCompleteNow()
}
}
diff --git a/http-core/src/test/scala/org/apache/pekko/http/impl/util/One2OneBidiFlowSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/impl/util/One2OneBidiFlowSpec.scala
index d6c2976fe..4cf96b7d5 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/impl/util/One2OneBidiFlowSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/impl/util/One2OneBidiFlowSpec.scala
@@ -74,7 +74,8 @@ class One2OneBidiFlowSpec extends PekkoSpec with Eventually {
downstreamProbe.expectError(One2OneBidiFlow.OutputTruncationException(1))
}
- "trigger an `UnexpectedOutputException` if the wrapped stream produces out-of-order elements" in assertAllStagesStopped {
+ "trigger an `UnexpectedOutputException` if the wrapped stream produces out-of-order elements" in
+ assertAllStagesStopped {
new Test() {
inIn.sendNext(1)
inOut.requestNext() should ===(1)
@@ -104,7 +105,8 @@ class One2OneBidiFlowSpec extends PekkoSpec with Eventually {
}
}
- "backpressure the input side if the maximum number of pending output elements has been reached" in assertAllStagesStopped {
+ "backpressure the input side if the maximum number of pending output elements has been reached" in
+ assertAllStagesStopped {
val MAX_PENDING = 24
val EMIT_ELEMENTS = 8
diff --git a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/ClientServerSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/ClientServerSpec.scala
index e53091199..068b3a1e0 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/ClientServerSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/ClientServerSpec.scala
@@ -336,7 +336,8 @@ abstract class ClientServerSpecBase(http2: Boolean) extends PekkoSpecWithMateria
} finally Await.result(b1.unbind(), 1.second.dilated)
}
- "avoid client vs. server race-condition for persistent connections with keep-alive-timeout" in Utils.assertAllStagesStopped {
+ "avoid client vs. server race-condition for persistent connections with keep-alive-timeout" in
+ Utils.assertAllStagesStopped {
def handler(request: HttpRequest): Future[HttpResponse] = Future.successful(HttpResponse())
val serverSettings = ServerSettings(system).mapTimeouts(_.withIdleTimeout(300.millis))
val binding = Http().newServerAt("127.0.0.1", 0).withSettings(serverSettings).bind(handler).futureValue
@@ -653,7 +654,8 @@ abstract class ClientServerSpecBase(http2: Boolean) extends PekkoSpecWithMateria
Http().shutdownAllConnectionPools().futureValue
}
- "complete a request/response when the request side immediately closes the connection after sending the request" in Utils.assertAllStagesStopped {
+ "complete a request/response when the request side immediately closes the connection after sending the request" in
+ Utils.assertAllStagesStopped {
// FIXME: with HTTP/2 enabled the connection is closed directly after receiving closing from client (i.e. half-closed
// HTTP connections are not allowed (whether they should be is a completely different question))
// https://github.com/akka/akka-http/issues/3964
@@ -687,7 +689,8 @@ Host: example.com
}
}
- "complete a request/response over https, disabling hostname verification with SSLConfigSettings" in Utils.assertAllStagesStopped {
+ "complete a request/response over https, disabling hostname verification with SSLConfigSettings" in
+ Utils.assertAllStagesStopped {
val serverConnectionContext = ExampleHttpContexts.exampleServerContext
val handlerFlow: Flow[HttpRequest, HttpResponse, Any] = Flow[HttpRequest].map { _ =>
HttpResponse(entity = "Okay")
@@ -836,7 +839,8 @@ Host: example.com
}
}
- "complete a request/response over https when server closes connection without close_notify" in Utils.assertAllStagesStopped {
+ "complete a request/response over https when server closes connection without close_notify" in
+ Utils.assertAllStagesStopped {
new CloseDelimitedTLSSetup {
killSwitch.shutdown() // simulate FIN in server -> client direction
// pekko-http is currently lenient wrt TLS truncation which is *not* reported to the user
@@ -845,7 +849,8 @@ Host: example.com
}
}
- "properly complete a simple request/response cycle when `modeled-header-parsing = off`" in Utils.assertAllStagesStopped {
+ "properly complete a simple request/response cycle when `modeled-header-parsing = off`" in
+ Utils.assertAllStagesStopped {
new TestSetup {
override def configOverrides = "pekko.http.parsing.modeled-header-parsing = off"
@@ -878,7 +883,8 @@ Host: example.com
}
}
- "properly complete a simple request/response cycle when `max-content-length` is set to 0" in Utils.assertAllStagesStopped {
+ "properly complete a simple request/response cycle when `max-content-length` is set to 0" in
+ Utils.assertAllStagesStopped {
new TestSetup {
override def configOverrides = """
pekko.http.client.parsing.max-content-length = 0
@@ -964,7 +970,8 @@ Host: example.com
Http().shutdownAllConnectionPools().futureValue
}
- "produce a useful error message when connecting to an endpoint speaking wrong protocol" in Utils.assertAllStagesStopped {
+ "produce a useful error message when connecting to an endpoint speaking wrong protocol" in
+ Utils.assertAllStagesStopped {
val settings = ConnectionPoolSettings(system).withUpdatedConnectionSettings(_.withIdleTimeout(100.millis))
val binding =
@@ -973,7 +980,8 @@ Host: example.com
val ex = the[IllegalResponseException] thrownBy Await.result(Http().singleRequest(HttpRequest(uri = uri,
method = HttpMethods.POST), settings = settings), 30.seconds)
- ex.info.formatPretty shouldEqual "The server-side protocol or HTTP version is not supported: start of response: [68 65 6C 6C 6F 20 77 6F 72 6C 64 21 | hello world!]"
+ ex.info.formatPretty shouldEqual
+ "The server-side protocol or HTTP version is not supported: start of response: [68 65 6C 6C 6F 20 77 6F 72 6C 64 21 | hello world!]"
Await.result(binding.unbind(), 10.seconds)
Http().shutdownAllConnectionPools().futureValue
diff --git a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/GracefulTerminationSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/GracefulTerminationSpec.scala
index 12c9059cd..e4b6481ef 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/GracefulTerminationSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/GracefulTerminationSpec.scala
@@ -149,7 +149,8 @@ class GracefulTerminationSpec
}
}
- "provide whenTerminated future that completes once server has completed termination (no connections)" in new TestSetup {
+ "provide whenTerminated future that completes once server has completed termination (no connections)" in
+ new TestSetup {
val time: FiniteDuration = 2.seconds
val deadline: Deadline = time.fromNow
@@ -161,7 +162,8 @@ class GracefulTerminationSpec
Await.result(serverBinding.whenTerminated, 3.seconds)
}
- "provide whenTerminated future that completes once server has completed termination (existing connection, no user reply)" in new TestSetup {
+ "provide whenTerminated future that completes once server has completed termination (existing connection, no user reply)" in
+ new TestSetup {
val r1 = makeRequest() // establish connection
val time: FiniteDuration = 1.second
@@ -180,7 +182,8 @@ class GracefulTerminationSpec
Await.result(serverBinding.whenTerminated, 2.seconds)
}
- "provide whenTerminated future that completes once server has completed termination (existing connection, user reply)" in new TestSetup {
+ "provide whenTerminated future that completes once server has completed termination (existing connection, user reply)" in
+ new TestSetup {
val r1 = makeRequest() // establish connection
val time: FiniteDuration = 3.seconds
@@ -195,7 +198,8 @@ class GracefulTerminationSpec
Await.result(serverBinding.whenTerminated, 3.seconds)
}
- "provide whenTerminated future that completes once server has completed termination (existing connection, user reply, terminate, no reply)" in new TestSetup {
+ "provide whenTerminated future that completes once server has completed termination (existing connection, user reply, terminate, no reply)" in
+ new TestSetup {
val r1 = makeRequest() // establish connection
val time: FiniteDuration = 3.seconds
@@ -214,7 +218,8 @@ class GracefulTerminationSpec
Await.result(serverBinding.whenTerminated, 3.seconds)
}
- "in-flight request responses should include additional Connection: close header and connection should be closed" in new TestSetup {
+ "in-flight request responses should include additional Connection: close header and connection should be closed" in
+ new TestSetup {
override val basePoolSettings: ConnectionPoolSettings =
super.basePoolSettings
.withTransport(new ClientTransport {
diff --git a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/MultipartSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/MultipartSpec.scala
index 0312a7c0b..b3cf9ffac 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/MultipartSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/MultipartSpec.scala
@@ -44,7 +44,8 @@ class MultipartSpec extends PekkoSpecWithMaterializer {
result.contentType shouldBe MediaTypes.`multipart/mixed`.withBoundary("boundary").toContentType
val encoding = Await.result(result.dataBytes.runWith(Sink.seq), 1.second.dilated)
encoding.map(
- _.utf8String).mkString shouldBe "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--"
+ _.utf8String).mkString shouldBe
+ "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--"
}
}
diff --git a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/headers/HeaderSpec.scala b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/headers/HeaderSpec.scala
index 663b80fb1..73424fbb7 100644
--- a/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/headers/HeaderSpec.scala
+++ b/http-core/src/test/scala/org/apache/pekko/http/scaladsl/model/headers/HeaderSpec.scala
@@ -38,7 +38,8 @@ class HeaderSpec extends AnyFreeSpec with Matchers {
}
"failing parse run" in {
val Left(List(ErrorInfo(summary, detail))) = headers.`Last-Modified`.parseFromValueString("abc")
- summary shouldEqual "Illegal HTTP header 'Last-Modified': Invalid input 'a', expected IMF-fixdate, asctime-date or '0' (line 1, column 1)"
+ summary shouldEqual
+ "Illegal HTTP header 'Last-Modified': Invalid input 'a', expected IMF-fixdate, asctime-date or '0' (line 1, column 1)"
detail shouldEqual
"""abc
|^""".stripMarginWithNewline("\n")
@@ -54,7 +55,8 @@ class HeaderSpec extends AnyFreeSpec with Matchers {
}
"failing parse run" in {
val Left(List(ErrorInfo(summary, detail))) = MediaType.parse("application//gnutar")
- summary shouldEqual "Illegal HTTP header 'Content-Type': Invalid input '/', expected subtype (line 1, column 13)"
+ summary shouldEqual
+ "Illegal HTTP header 'Content-Type': Invalid input '/', expected subtype (line 1, column 13)"
detail shouldEqual
"""application//gnutar
| ^""".stripMarginWithNewline("\n")
@@ -70,7 +72,8 @@ class HeaderSpec extends AnyFreeSpec with Matchers {
}
"failing parse run" in {
val Left(List(ErrorInfo(summary, detail))) = ContentType.parse("text/plain, charset=UTF8")
- summary shouldEqual "Illegal HTTP header 'Content-Type': Invalid input ',', expected tchar, OWS, ws or 'EOI' (line 1, column 11)"
+ summary shouldEqual
+ "Illegal HTTP header 'Content-Type': Invalid input ',', expected tchar, OWS, ws or 'EOI' (line 1, column 11)"
detail shouldEqual
"""text/plain, charset=UTF8
| ^""".stripMarginWithNewline("\n")
@@ -87,11 +90,14 @@ class HeaderSpec extends AnyFreeSpec with Matchers {
}
"failing parse run" in {
val Left(List(ErrorInfo(summary, detail))) = `Retry-After`.parseFromValueString("011")
- summary shouldEqual "Illegal HTTP header 'Retry-After': Invalid input '1', expected OWS or 'EOI' (line 1, column 2)"
+ summary shouldEqual
+ "Illegal HTTP header 'Retry-After': Invalid input '1', expected OWS or 'EOI' (line 1, column 2)"
val Left(List(ErrorInfo(summary2, detail2))) = `Retry-After`.parseFromValueString("-10")
- summary2 shouldEqual "Illegal HTTP header 'Retry-After': Invalid input '-', expected HTTP-date or delta-seconds (line 1, column 1)"
+ summary2 shouldEqual
+ "Illegal HTTP header 'Retry-After': Invalid input '-', expected HTTP-date or delta-seconds (line 1, column 1)"
val Left(List(ErrorInfo(summary3, detail3))) = `Retry-After`.parseFromValueString("2015-10-21H07:28:00Z")
- summary3 shouldEqual "Illegal HTTP header 'Retry-After': Invalid input '-', expected DIGIT, OWS or 'EOI' (line 1, column 5)"
+ summary3 shouldEqual
+ "Illegal HTTP header 'Retry-After': Invalid input '-', expected DIGIT, OWS or 'EOI' (line 1, column 5)"
}
}
}
diff --git a/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala b/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
index d7c56c075..1e4573988 100644
--- a/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
+++ b/http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit/MultiNodeConfig.scala
@@ -120,7 +120,8 @@ abstract class MultiNodeConfig {
else ConfigFactory.empty
val configs = _nodeConf.get(
- myself).toList ::: _commonConf.toList ::: transportConfig :: MultiNodeSpec.nodeConfig :: MultiNodeSpec.baseConfig :: Nil
+ myself).toList ::: _commonConf.toList ::: transportConfig :: MultiNodeSpec.nodeConfig ::
+ MultiNodeSpec.baseConfig :: Nil
configs.reduceLeft(_ withFallback _)
}
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/TcpLeakApp.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/TcpLeakApp.scala
index a78c1e6b3..5e0de71de 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/TcpLeakApp.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/TcpLeakApp.scala
@@ -52,8 +52,9 @@ object TcpLeakApp extends App {
result =>
println(s"Result: $result")
Thread.sleep(10000)
- println("===================== \n\n" + system.asInstanceOf[
- ActorSystemImpl].printTree + "\n\n========================")
+ println("===================== \n\n" +
+ system.asInstanceOf[
+ ActorSystemImpl].printTree + "\n\n========================")
}
Thread.sleep(11000)
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/DebuggingDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/DebuggingDirectivesSpec.scala
index b88bea1aa..67400f878 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/DebuggingDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/DebuggingDirectivesSpec.scala
@@ -53,7 +53,8 @@ class DebuggingDirectivesSpec extends RoutingSpec {
resetDebugMsg()
Get("/hello") ~> route ~> check {
response shouldEqual Ok
- normalizedDebugMsg() shouldEqual "1: HttpRequest(HttpMethod(GET),http://example.com/hello,List(),HttpEntity.Strict(none/none,0 bytes total),HttpProtocol(HTTP/1.1))\n"
+ normalizedDebugMsg() shouldEqual
+ "1: HttpRequest(HttpMethod(GET),http://example.com/hello,List(),HttpEntity.Strict(none/none,0 bytes total),HttpProtocol(HTTP/1.1))\n"
}
}
}
@@ -68,7 +69,8 @@ class DebuggingDirectivesSpec extends RoutingSpec {
resetDebugMsg()
Get("/hello") ~> route ~> check {
response shouldEqual Ok
- normalizedDebugMsg() shouldEqual "2: Complete(HttpResponse(200 OK,List(),HttpEntity.Strict(none/none,0 bytes total),HttpProtocol(HTTP/1.1)))\n"
+ normalizedDebugMsg() shouldEqual
+ "2: Complete(HttpResponse(200 OK,List(),HttpEntity.Strict(none/none,0 bytes total),HttpProtocol(HTTP/1.1)))\n"
}
}
}
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/ExecutionDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/ExecutionDirectivesSpec.scala
index f365a7ea2..4dbe4596a 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/ExecutionDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/ExecutionDirectivesSpec.scala
@@ -156,7 +156,8 @@ class ExecutionDirectivesSpec extends RoutingSpec {
}
}
- "handle exceptions other than `IllegalRequestException` with appropriate block of `ErrorHandler`" in EventFilter[
+ "handle exceptions other than `IllegalRequestException` with appropriate block of `ErrorHandler`" in
+ EventFilter[
RuntimeException](
occurrences = 1,
message = BasicRouteSpecs.defaultExnHandler500Error("re")).intercept {
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FileUploadDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FileUploadDirectivesSpec.scala
index 172dd1ed1..2d7cf7bd9 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FileUploadDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FileUploadDirectivesSpec.scala
@@ -479,18 +479,8 @@ class MockFailingWritePath extends java.nio.file.Path { selfPath =>
import java.nio.{ ByteBuffer, MappedByteBuffer }
import java.nio.channels.{ FileChannel, FileLock, ReadableByteChannel, SeekableByteChannel, WritableByteChannel }
import java.nio.file.{
- AccessMode,
- CopyOption,
- DirectoryStream,
- FileStore,
- FileSystem,
- LinkOption,
- OpenOption,
- Path,
- PathMatcher,
- WatchEvent,
- WatchKey,
- WatchService
+ AccessMode, CopyOption, DirectoryStream, FileStore, FileSystem, LinkOption, OpenOption, Path, PathMatcher,
+ WatchEvent, WatchKey, WatchService
}
import java.nio.file.attribute.{ BasicFileAttributes, FileAttribute, FileAttributeView, UserPrincipalLookupService }
import java.nio.file.spi.FileSystemProvider
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FutureDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FutureDirectivesSpec.scala
index 147c725db..12e474c45 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FutureDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/FutureDirectivesSpec.scala
@@ -61,14 +61,16 @@ class FutureDirectivesSpec extends RoutingSpec with Inside with TestKitBase {
"catch an exception in the success case" in {
Get() ~> showEx(onComplete(Future.successful("ok")) { throwTestException("EX when ") }) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Success(ok)"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Success(ok)"
}
}
"catch an exception in the failure case" in {
Get() ~> showEx(
onComplete(Future.failed[String](new RuntimeException("no"))) { throwTestException("EX when ") }) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Failure(java.lang.RuntimeException: no)"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Failure(java.lang.RuntimeException: no)"
}
}
}
@@ -117,7 +119,8 @@ class FutureDirectivesSpec extends RoutingSpec with Inside with TestKitBase {
Get() ~> showEx(
onCompleteWithBreaker(breaker)(Future.successful("ok")) { throwTestException("EX when ") }) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Success(ok)"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Success(ok)"
}
}
"catch an exception in the failure case" in new TestWithCircuitBreaker {
@@ -125,7 +128,8 @@ class FutureDirectivesSpec extends RoutingSpec with Inside with TestKitBase {
throwTestException("EX when ")
}) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Failure(java.lang.RuntimeException: no)"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Failure(java.lang.RuntimeException: no)"
}
}
}
@@ -146,7 +150,8 @@ class FutureDirectivesSpec extends RoutingSpec with Inside with TestKitBase {
"catch an exception in the success case" in {
Get() ~> showEx(onSuccess(Future.successful("ok")) { throwTestException("EX when ") }) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when ok"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when ok"
}
}
"catch an exception in the failure case" in EventFilter[TestException.type](
@@ -184,7 +189,8 @@ class FutureDirectivesSpec extends RoutingSpec with Inside with TestKitBase {
Get() ~> showEx(
completeOrRecoverWith(Future.failed[String](TestException)) { throwTestException("EX when ") }) ~> check {
status shouldEqual StatusCodes.InternalServerError
- responseAs[String] shouldEqual s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException$$: XXX"
+ responseAs[String] shouldEqual
+ s"Oops. org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when org.apache.pekko.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException$$: XXX"
}
}
}
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/MiscDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/MiscDirectivesSpec.scala
index 963826cec..978efc58f 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/MiscDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/MiscDirectivesSpec.scala
@@ -125,7 +125,8 @@ class MiscDirectivesSpec extends RoutingSpec {
Post("/abc", formDataOfSize(128)) ~> Route.seal(route) ~> check {
status shouldEqual StatusCodes.ContentTooLarge
- responseAs[String] shouldEqual "The request content was malformed:\n" +
+ responseAs[String] shouldEqual
+ "The request content was malformed:\n" +
"EntityStreamSizeException: incoming entity size (134) " +
"exceeded size limit (64 bytes)! " +
"This may have been a parser limit (set via `pekko.http.[server|client].parsing.max-content-length`), " +
diff --git a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/WebSocketDirectivesSpec.scala b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/WebSocketDirectivesSpec.scala
index ae3c5cfe5..2e293f242 100644
--- a/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/WebSocketDirectivesSpec.scala
+++ b/http-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/WebSocketDirectivesSpec.scala
@@ -18,10 +18,7 @@ import pekko.http.scaladsl.model.StatusCodes
import pekko.http.scaladsl.model.headers.`Sec-WebSocket-Protocol`
import pekko.http.scaladsl.model.ws._
import pekko.http.scaladsl.server.{
- ExpectedWebSocketRequestRejection,
- Route,
- RoutingSpec,
- UnsupportedWebSocketSubprotocolRejection
+ ExpectedWebSocketRequestRejection, Route, RoutingSpec, UnsupportedWebSocketSubprotocolRejection
}
import pekko.http.scaladsl.testkit.WSProbe
import pekko.stream.OverflowStrategy
@@ -80,7 +77,8 @@ class WebSocketDirectivesSpec extends RoutingSpec {
WS("http://localhost/", Flow[Message], List("other")) ~> Route.seal(websocketMultipleProtocolRoute) ~> check {
status shouldEqual StatusCodes.BadRequest
- responseAs[String] shouldEqual "None of the websocket subprotocols offered in the request are supported. Supported are 'echo','greeter'."
+ responseAs[String] shouldEqual
+ "None of the websocket subprotocols offered in the request are supported. Supported are 'echo','greeter'."
header[`Sec-WebSocket-Protocol`].get.protocols.toSet shouldEqual Set("greeter", "echo")
}
}
diff --git a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala
index 72b714273..9fe206d57 100644
--- a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala
+++ b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/BasicDirectives.scala
@@ -33,13 +33,7 @@ import pekko.http.impl.model.JavaUri
import pekko.http.impl.util.JavaMapping
import pekko.http.impl.util.Util.convertIterable
import pekko.http.javadsl.model.{
- HttpEntity,
- HttpHeader,
- HttpRequest,
- HttpResponse,
- RequestEntity,
- ResponseEntity,
- Uri
+ HttpEntity, HttpHeader, HttpRequest, HttpResponse, RequestEntity, ResponseEntity, Uri
}
import pekko.http.javadsl.server
import pekko.http.javadsl.server._
diff --git a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
index 3d31c7f66..b1972828a 100644
--- a/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
+++ b/http/src/main/scala/org/apache/pekko/http/javadsl/server/directives/RouteDirectives.scala
@@ -22,13 +22,7 @@ import org.apache.pekko
import pekko.http.impl.model.JavaUri
import pekko.http.javadsl.marshalling.Marshaller
import pekko.http.javadsl.model.{
- HttpHeader,
- HttpRequest,
- HttpResponse,
- RequestEntity,
- ResponseEntity,
- StatusCode,
- Uri
+ HttpHeader, HttpRequest, HttpResponse, RequestEntity, ResponseEntity, StatusCode, Uri
}
import pekko.http.javadsl.server.{ Rejection, Route, RoutingJavaMapping }
import pekko.http.javadsl.server.RoutingJavaMapping._
diff --git a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CacheConditionDirectives.scala b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CacheConditionDirectives.scala
index 6ff40e1ab..9bc1f0089 100644
--- a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CacheConditionDirectives.scala
+++ b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CacheConditionDirectives.scala
@@ -101,7 +101,7 @@ trait CacheConditionDirectives {
mapInnerRoute { route =>
def innerRouteWithRangeHeaderFilteredOut: Route =
(mapRequest(_.mapHeaders(_.filterNot(_.isInstanceOf[Range]))) &
- addResponseHeaders)(route)
+ addResponseHeaders)(route)
def isGetOrHead = method == HEAD || method == GET
def unmodified(ifModifiedSince: DateTime) =
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientServerSpec.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientServerSpec.scala
index 75c8d9f5f..7a5dd9873 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientServerSpec.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientServerSpec.scala
@@ -23,19 +23,8 @@ import pekko.http.impl.engine.ws.ByteStringSinkProbe
import pekko.http.impl.util.{ ExampleHttpContexts, PekkoSpecWithMaterializer }
import pekko.http.scaladsl.Http
import pekko.http.scaladsl.model.{
- headers,
- AttributeKey,
- ContentTypes,
- HttpEntity,
- HttpHeader,
- HttpMethod,
- HttpMethods,
- HttpRequest,
- HttpResponse,
- RequestResponseAssociation,
- StatusCode,
- StatusCodes,
- Uri
+ headers, AttributeKey, ContentTypes, HttpEntity, HttpHeader, HttpMethod, HttpMethods, HttpRequest, HttpResponse,
+ RequestResponseAssociation, StatusCode, StatusCodes, Uri
}
import pekko.http.scaladsl.model.headers.HttpEncodings
import pekko.http.scaladsl.settings.ClientConnectionSettings
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientSpec.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientSpec.scala
index d17c0185f..64c438220 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientSpec.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ClientSpec.scala
@@ -40,11 +40,7 @@ import pekko.http.scaladsl.model.HttpEntity.Chunked
import pekko.http.scaladsl.model.HttpEntity.LastChunk
import pekko.http.scaladsl.model.HttpMethods.GET
import pekko.http.scaladsl.model.headers.{
- `Access-Control-Allow-Origin`,
- `Cache-Control`,
- `Content-Length`,
- `Content-Type`,
- RawHeader
+ `Access-Control-Allow-Origin`, `Cache-Control`, `Content-Length`, `Content-Type`, RawHeader
}
import pekko.http.scaladsl.model.headers.CacheDirectives._
import pekko.http.scaladsl.settings.ClientConnectionSettings
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2FrameSending.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2FrameSending.scala
index 7d84fd572..fa83b372d 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2FrameSending.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2FrameSending.scala
@@ -17,12 +17,7 @@ import java.nio.ByteOrder
import org.apache.pekko
import pekko.http.impl.engine.http2.FrameEvent.{
- ContinuationFrame,
- HeadersFrame,
- PriorityFrame,
- Setting,
- SettingsFrame,
- WindowUpdateFrame
+ ContinuationFrame, HeadersFrame, PriorityFrame, Setting, SettingsFrame, WindowUpdateFrame
}
import pekko.http.impl.engine.http2.Http2Protocol.{ ErrorCode, Flags, FrameType, SettingIdentifier }
import pekko.http.impl.engine.http2.framing.FrameRenderer
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2PersistentClientSpec.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2PersistentClientSpec.scala
index b9e25cfb6..338080a29 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2PersistentClientSpec.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2PersistentClientSpec.scala
@@ -26,20 +26,8 @@ import pekko.http.impl.engine.ws.ByteStringSinkProbe
import pekko.http.impl.util.{ ExampleHttpContexts, PekkoSpecWithMaterializer }
import pekko.http.scaladsl.{ ClientTransport, Http }
import pekko.http.scaladsl.model.{
- headers,
- AttributeKey,
- AttributeKeys,
- ContentTypes,
- HttpEntity,
- HttpHeader,
- HttpMethod,
- HttpMethods,
- HttpRequest,
- HttpResponse,
- RequestResponseAssociation,
- StatusCode,
- StatusCodes,
- Uri
+ headers, AttributeKey, AttributeKeys, ContentTypes, HttpEntity, HttpHeader, HttpMethod, HttpMethods, HttpRequest,
+ HttpResponse, RequestResponseAssociation, StatusCode, StatusCodes, Uri
}
import pekko.http.scaladsl.model.headers.HttpEncodings
import pekko.http.scaladsl.settings.ClientConnectionSettings
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerSpec.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerSpec.scala
index 4a82247aa..7a8846435 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerSpec.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerSpec.scala
@@ -528,7 +528,8 @@ class Http2ServerSpec extends Http2SpecWithMaterializer("""
network.fromNet.sendError(new RuntimeException("connection crashed"))
// we have received all data for the stream, but the substream cannot push it any more because the owning stage is gone
- entityDataIn.expectError().getMessage shouldBe "The HTTP/2 connection was shut down while the request was still ongoing"
+ entityDataIn.expectError().getMessage shouldBe
+ "The HTTP/2 connection was shut down while the request was still ongoing"
})
"fail if DATA frame arrives after incoming stream has already been closed (before response was sent)".inAssertAllStagesStopped(
new WaitingForRequestData {
@@ -546,7 +547,8 @@ class Http2ServerSpec extends Http2SpecWithMaterializer("""
errorCode shouldEqual ErrorCode.PROTOCOL_ERROR
// we have received all data for the stream, but the substream cannot push it any more because the owning stage is gone
- entityDataIn.expectError().getMessage shouldBe "The HTTP/2 connection was shut down while the request was still ongoing"
+ entityDataIn.expectError().getMessage shouldBe
+ "The HTTP/2 connection was shut down while the request was still ongoing"
})
"fail entity stream if advertised content-length doesn't match" in pending
@@ -1243,7 +1245,8 @@ class Http2ServerSpec extends Http2SpecWithMaterializer("""
network.fromNet.sendError(new RuntimeException("Connection broke"))
// now all stream stages should be closed
- reqProbe.expectError().getMessage shouldBe "The HTTP/2 connection was shut down while the request was still ongoing"
+ reqProbe.expectError().getMessage shouldBe
+ "The HTTP/2 connection was shut down while the request was still ongoing"
responseEntityProbe.expectCancellation()
}))
}
@@ -1252,7 +1255,8 @@ class Http2ServerSpec extends Http2SpecWithMaterializer("""
"not exceed connection-level window while sending" in pending
"not exceed stream-level window while sending" in pending
"not exceed stream-level window while sending after SETTINGS_INITIAL_WINDOW_SIZE changed" in pending
- "not exceed stream-level window while sending after SETTINGS_INITIAL_WINDOW_SIZE changed when window became negative through setting" in pending
+ "not exceed stream-level window while sending after SETTINGS_INITIAL_WINDOW_SIZE changed when window became negative through setting" in
+ pending
"reject WINDOW_UPDATE for connection with zero increment with PROTOCOL_ERROR".inAssertAllStagesStopped(
new TestSetup with RequestResponseProbes {
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/RequestParsingSpec.scala b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/RequestParsingSpec.scala
index 6ee9c5f42..a844bd762 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/RequestParsingSpec.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/RequestParsingSpec.scala
@@ -221,12 +221,13 @@ class RequestParsingSpec extends PekkoSpecWithMaterializer with Inside with Insp
val authorities = Seq("?", " ", "@", ":")
forAll(authorities) { authority =>
- val thrown = the[ParsingException] thrownBy (parse(
- keyValuePairs = Vector(
- ":method" -> "POST",
- ":scheme" -> "https",
- ":authority" -> authority,
- ":path" -> "/")))
+ val thrown = the[ParsingException] thrownBy
+ (parse(
+ keyValuePairs = Vector(
+ ":method" -> "POST",
+ ":scheme" -> "https",
+ ":authority" -> authority,
+ ":path" -> "/")))
thrown.getMessage should include("http2-authority-pseudo-header")
}
}
@@ -248,12 +249,13 @@ class RequestParsingSpec extends PekkoSpecWithMaterializer with Inside with Insp
val schemes = Seq("http", "https")
forAll(schemes) { (scheme: String) =>
forAll(authorities) { (authority: String) =>
- val exception = the[Exception] thrownBy (parse(
- keyValuePairs = Vector(
- ":method" -> "POST",
- ":scheme" -> scheme,
- ":authority" -> authority,
- ":path" -> "/")))
+ val exception = the[Exception] thrownBy
+ (parse(
+ keyValuePairs = Vector(
+ ":method" -> "POST",
+ ":scheme" -> scheme,
+ ":authority" -> authority,
+ ":path" -> "/")))
exception.getMessage should startWith("Illegal http2-authority-pseudo-header")
}
}
diff --git a/http2-tests/src/test/scala/org/apache/pekko/http/scaladsl/Http2ServerTest.scala b/http2-tests/src/test/scala/org/apache/pekko/http/scaladsl/Http2ServerTest.scala
index 556e0b787..588bbf7be 100644
--- a/http2-tests/src/test/scala/org/apache/pekko/http/scaladsl/Http2ServerTest.scala
+++ b/http2-tests/src/test/scala/org/apache/pekko/http/scaladsl/Http2ServerTest.scala
@@ -74,7 +74,8 @@ object Http2ServerTest extends App {
formData.parts.runFoldAsync("") { (msg, part) =>
part.entity.dataBytes.runFold(0)(_ + _.size)
.map(dataSize =>
- msg + s"${part.name} ${part.filename} $dataSize ${part.entity.contentType} ${part.additionalDispositionParams}\n")
+ msg +
+ s"${part.name} ${part.filename} $dataSize ${part.entity.contentType} ${part.additionalDispositionParams}\n")
}
}
.map { msg =>
diff --git a/project/Doc.scala b/project/Doc.scala
index d68af10a1..ee89a4dfb 100644
--- a/project/Doc.scala
+++ b/project/Doc.scala
@@ -156,8 +156,9 @@ object UnidocRoot extends AutoPlugin {
// fails since Akka HTTP 10.0.11 disabled to get the doc gen to pass, see #1584
// scalacOptions += "-P:genjavadoc:suppressSynthetic=false",
// FIXME: see https://github.com/akka/akka-http/issues/230
- JavaUnidoc / unidoc / sources ~= (_.filterNot(
- _.getPath.contains("Access$minusControl$minusAllow$minusOrigin"))))).getOrElse(Nil)
+ JavaUnidoc / unidoc / sources ~=
+ (_.filterNot(
+ _.getPath.contains("Access$minusControl$minusAllow$minusOrigin"))))).getOrElse(Nil)
val settings = inTask(unidoc)(Seq(
ScalaUnidoc / unidocProjectFilter := inAnyProject -- inProjects(unidocProjectExcludes.value: _*),
diff --git a/project/ParadoxSupport.scala b/project/ParadoxSupport.scala
index 5da5768db..9ff13bbe9 100644
--- a/project/ParadoxSupport.scala
+++ b/project/ParadoxSupport.scala
@@ -27,8 +27,9 @@ import scala.io.{ Codec, Source }
object ParadoxSupport {
val paradoxWithCustomDirectives = Seq(
- paradoxDirectives += ((context: Writer.Context) =>
- new SignatureDirective(context.location.tree.label, context.properties, context)),
+ paradoxDirectives +=
+ ((context: Writer.Context) =>
+ new SignatureDirective(context.location.tree.label, context.properties, context)),
pekkoParadoxGithub := Some("https://github.com/apache/pekko-http"),
Global / pekkoParadoxIncubatorNotice := None,
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
diff --git a/project/ValidatePullRequest.scala b/project/ValidatePullRequest.scala
index 75cf74b08..b4f6d888d 100644
--- a/project/ValidatePullRequest.scala
+++ b/project/ValidatePullRequest.scala
@@ -202,7 +202,8 @@ object ValidatePullRequest extends AutoPlugin {
BuildFilesAndDirectories.contains(dir))
.toSet
log.info(
- "Detected uncommitted changes in directories (including in dependency analysis): " + dirtyDirectories.mkString(
+ "Detected uncommitted changes in directories (including in dependency analysis): " +
+ dirtyDirectories.mkString(
"[", ",", "]"))
dirtyDirectories
}
@@ -255,10 +256,12 @@ object ValidatePullRequest extends AutoPlugin {
buildMode.log(name.value, log)
- val validationTasks: Seq[TaskKey[Any]] = (buildMode.task.toSeq ++ (buildMode match {
- case BuildSkip => Seq.empty // do not run the additional task if project is skipped during pr validation
- case _ => (ValidatePR / additionalTasks).value
- })).asInstanceOf[Seq[TaskKey[Any]]]
+ val validationTasks: Seq[TaskKey[Any]] =
+ (buildMode.task.toSeq ++
+ (buildMode match {
+ case BuildSkip => Seq.empty // do not run the additional task if project is skipped during pr validation
+ case _ => (ValidatePR / additionalTasks).value
+ })).asInstanceOf[Seq[TaskKey[Any]]]
val thisProject = Def.resolvedScoped.value.scope.project.toOption.get
@@ -532,17 +535,18 @@ object MimaWithPrValidation extends AutoPlugin {
Ordering[(Int, Int, Int)].on[String] { case VersionRegex(x, y, z) => (int(x), int(y), int(z)) }
}
def isReported(module: ModuleID, verionedFilters: Map[String, Seq[core.ProblemFilter]])(
- problem: core.Problem) = (verionedFilters.collect {
- // get all filters that apply to given module version or any version after it
- case f @ (version, filters) if versionOrdering.gteq(version, module.revision) => filters
- }.flatten ++ filters).forall { f =>
- if (f(problem)) {
- true
- } else {
- // log(projectName + ": filtered out: " + problem.description + "\n filtered by: " + f)
- false
+ problem: core.Problem) =
+ (verionedFilters.collect {
+ // get all filters that apply to given module version or any version after it
+ case f @ (version, filters) if versionOrdering.gteq(version, module.revision) => filters
+ }.flatten ++ filters).forall { f =>
+ if (f(problem)) {
+ true
+ } else {
+ // log(projectName + ": filtered out: " + problem.description + "\n filtered by: " + f)
+ false
+ }
}
- }
val backErrors = backward.filter(isReported(module, backwardFilters))
val forwErrors = forward.filter(isReported(module, forwardFilters))