fixing tests
continuous-integration/drone/push Build is passing Details

dev
Override-6 2 years ago
parent ceb53e5abb
commit f3782f492d

@ -63,7 +63,7 @@ final class FileServerConfig private(userProperties: Properties, schema: Propert
override val databaseConfigName: String = getPropertySafe("database.prefix")
override def pagesLocation: Path = Path.of(getPropertySafe("pages.location"))
override def pagesLocation: Option[Path] = Some(Path.of(getPropertySafe("pages.location")))
private def schemaString = {
schema.stringPropertyNames()

@ -18,6 +18,6 @@ trait ServerConfig {
def databaseConfigName: String
def pagesLocation: Path
def pagesLocation: Option[Path]
}

@ -9,7 +9,7 @@ import zio.stream.ZStream
import java.nio.file.{Files, Path}
import scala.collection.mutable
class WebService(pagesLocation: Path) {
class WebService(pagesLocation: Option[Path]) {
private val resources = resolveResources
@ -52,8 +52,7 @@ class WebService(pagesLocation: Path) {
}
}
}
resolveAll(pagesLocation)
pagesLocation.foreach(resolveAll)
map.toMap
}
}

@ -26,8 +26,8 @@ object HandlerUtils {
def parseRequestForm(body: Body) =
(for
decoded <- body.asString.map(str => URLDecoder.decode(str.stripPrefix("&"), StandardCharsets.UTF_8.name()))
params = decoded.split('&').collect { case s"$k=$v" => (k, v)}.toMap
decoded <- body.asString.map(str => URLDecoder.decode(str, StandardCharsets.UTF_8.name()))
params = decoded.split('&').collect { case s"$k=$v" => (k.stripPrefix("?"), v)}.toMap
yield params)
.mapError(s => InvalidRequest("Invalid request body", s.getMessage))

@ -29,5 +29,5 @@ object TestServerConfig extends ServerConfig {
override def databaseConfigName: String = "test-database"
override def pagesLocation: Path = Path.of("www")
override def pagesLocation: Option[Path] = None
}