Skip to content

Commit

Permalink
Remove image formats
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jan 20, 2024
1 parent 532d583 commit 8166bdb
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/server/server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -336,32 +336,10 @@ case class HttpServer(port: Int) extends RequestHandler:
exchange.getResponseBody.nn.flush()
exchange.close()

case class Svg(content: Text)

object Svg:
// FIXME: The character encoding depends on the XML header, which should be parsed
given SimpleHandler[Svg] =
SimpleHandler(media"image/svg+xml", svg => HttpBody.Data(svg.content.bytes(using charEncoders.utf8)))

case class Jpeg(content: IArray[Byte])

object Jpeg:
given SimpleHandler[Jpeg] = SimpleHandler(media"image/jpeg", jpeg => HttpBody.Data(jpeg.content))

case class Gif(content: IArray[Byte])

object Gif:
given SimpleHandler[Gif] = SimpleHandler(media"image/gif", gif => HttpBody.Data(gif.content))

case class Ttf(content: Bytes)
object Ttf:
given SimpleHandler[Ttf] = SimpleHandler(media"application/octet-stream", ttf => HttpBody.Data(ttf.content))

case class Png(content: IArray[Byte])

object Png:
given SimpleHandler[Png] = SimpleHandler(media"image/png", png => HttpBody.Data(png.content))

def basicAuth(validate: (Text, Text) => Boolean, realm: Text)(response: => Response[?])
(using Request): Response[?] =
request.headers.get(RequestHeader.Authorization) match
Expand Down

0 comments on commit 8166bdb

Please sign in to comment.