Skip to content

Releases: zio/zio-http

v2.0.0-RC8 - ZIO 2 Support

02 Jun 11:29
085ea0d
Compare
Choose a tag to compare

Changes

Supports ZIO v2.0.0-RC6

Breaking Changes

🚀 Features

Improvements

🐛 Bug Fixes

🧰 Maintenance

New Contributors

Full Changelog: v2.0.0-RC7...v2.0.0-RC8

v1.0.0.0-RC28

30 May 09:01
c192286
Compare
Choose a tag to compare

Changes

Breaking Changes

🚀 Features

Improvements

🐛 Bug Fixes

🧰 Maintenance

New Contributors

Full Changelog: v1.0.0.0-RC27...v1.0.0.0-RC28

v2.0.0-RC7 - ZIO 2 Support

20 Apr 05:23
a50397f
Compare
Choose a tag to compare

What's Changed

Supports ZIO v2.0.0-RC5

Full Changelog: v2.0.0-RC6...v2.0.0-RC7

v2.0.0-RC6 ZIO 2 Support

04 Apr 12:18
a320cca
Compare
Choose a tag to compare

What's Changed

Supports ZIO v2.0.0-RC4

Maintenance

Full Changelog: v2.0.0-RC5...v2.0.0-RC6

v2.0.0-RC5 - ZIO 2 Support

01 Apr 13:17
e2e3561
Compare
Choose a tag to compare

What's Changed

Supports ZIO v2.0.0-RC3

Highlights

Request Streaming

  private val app = Http.collect[Request] {
   case req @ Method.POST -> !! / "echo" =>
   Response(data = HttpData.fromStream(req.bodyAsStream))
  }

💥 Breaking Changes

  • Http.Status names to Camel Case
    Status.OK -> Status.Ok
  • Http.getResource consistent with ZStream.fromResource
    val httpApp = Http.fromResource("TestFile.js")
  • Client and Server Request merged
    val clientRequest = Request(url = url, method = Method.GET,  headers = headers )
  • Version added in the Request
    val req = Request(Version.`HTTP/1.1`, Method.GET, URL(!!))

🚀 Features

🔨 Improvements

🐛 Bug Fixes

🧰 Maintenance

New Contributors

Full Changelog: v2.0.0-RC4...v2.0.0-RC5

v1.0.0.0-RC27

01 Apr 14:21
f4d6b6d
Compare
Choose a tag to compare

Changes

Bugfix

Full Changelog: v1.0.0.0-RC26...v1.0.0.0-RC27

v1.0.0.0-RC26

31 Mar 11:29
d978571
Compare
Choose a tag to compare

Changes

Highlights

Request Streaming

  private val app = Http.collect[Request] {
   case req @ Method.POST -> !! / "echo" =>
   Response(data = HttpData.fromStream(req.bodyAsStream))
  }

💥 Breaking Changes

  • Http.Status names to Camel Case
    Status.OK -> Status.Ok
  • Http.getResource consistent with ZStream.fromResource
    val httpApp = Http.fromResource("TestFile.js")
  • Client and Server Request merged
    val clientRequest = Request(url = url, method = Method.GET,  headers = headers )
  • Version added in the Request
    val req = Request(Version.`HTTP/1.1`, Method.GET, URL(!!))

🚀 Features

🔨 Improvements

🐛 Bug Fixes

🧰 Maintenance

New Contributors

Full Changelog: v1.0.0.0-RC25...v1.0.0.0-RC26

v2.0.0-RC4 - ZIO 2 Support

23 Feb 13:06
c782fda
Compare
Choose a tag to compare

Supports ZIO v2.0.0-RC2

Highlights

  • Support for Static Server
    ZIO-HTTP now provides support for building static servers with a very simple DSL.

    // A simple app to serve static resource files from a local directory.
    val app = Http.collectHttp[Request] { case Method.GET -> "static" /: path =>
        for {
        file <- Http.getResourceAsFile(path.encode)
        http <-
            // Rendering a custom UI to list all the files in the directory
            if (file.isDirectory) {
    
            // Accessing the files in the directory
            val files = file.listFiles.toList.sortBy(_.getName)
            val base  = "/static"
            val rest  = path.dropLast(1)
    
            // Custom UI to list all the files in the directory
            Http.template(s"File Explorer ~$base${path}") {
                ul(
                li(a(href := s"$base$rest", "..")),
                files.map { file =>
                    li(
                    a(
                        href := s"$base${path.encode}${if (path.isEnd) file.getName else "/" + file.getName}",
                        file.getName,
                    ),
                    )
                },
                )
            }
            }
    
            // Return the file if it's a static resource
            else if (file.isFile) Http.fromFile(file)
    
            // Return a 404 if the file doesn't exist
            else Http.empty
        } yield http
    }
  • New Http.attempt operator
    Attempts to create an Http that succeeds with the provided value, capturing all exceptions on it's way.

    val app = Http.attempt(throw throwable).execute(())

💥 Breaking Changes

  • Rename provide and provideSome in Http and Socket domains
    Previous Current
    provide provideEnvironment
    provideSome provideSomeEnvironment

🚀 Features

Improvements

🐛 Bug Fixes

🧰 Maintenance

Full Changelog: v2.0.0-RC3...v2.0.0-RC4

v1.0.0.0-RC25

23 Feb 13:04
f632f58
Compare
Choose a tag to compare

Changes

Highlights

  • Support for Static Server
    ZIO-HTTP now provides support for building static servers with a very simple DSL.

    // A simple app to serve static resource files from a local directory.
    val app = Http.collectHttp[Request] { case Method.GET -> "static" /: path =>
        for {
        file <- Http.getResourceAsFile(path.encode)
        http <-
            // Rendering a custom UI to list all the files in the directory
            if (file.isDirectory) {
    
            // Accessing the files in the directory
            val files = file.listFiles.toList.sortBy(_.getName)
            val base  = "/static"
            val rest  = path.dropLast(1)
    
            // Custom UI to list all the files in the directory
            Http.template(s"File Explorer ~$base${path}") {
                ul(
                li(a(href := s"$base$rest", "..")),
                files.map { file =>
                    li(
                    a(
                        href := s"$base${path.encode}${if (path.isEnd) file.getName else "/" + file.getName}",
                        file.getName,
                    ),
                    )
                },
                )
            }
            }
    
            // Return the file if it's a static resource
            else if (file.isFile) Http.fromFile(file)
    
            // Return a 404 if the file doesn't exist
            else Http.empty
        } yield http
    }
  • New Http.attempt operator
    Attempts to create an Http that succeeds with the provided value, capturing all exceptions on it's way.

    val app = Http.attempt(throw throwable).execute(())

💥 Breaking Changes

  • Rename provide and provideSome in Http and Socket domains
    Previous Current
    provide provideEnvironment
    provideSome provideSomeEnvironment

🚀 Features

Improvements

🐛 Bug Fixes

🧰 Maintenance

Full Changelog: v1.0.0.0-RC24...v2.0.0

v2.0.0-RC3 - ZIO 2 Support

10 Feb 04:43
b9527a4
Compare
Choose a tag to compare

Supports ZIO v2.0.0-RC2

Highlights

  • Websocket Client Support

      val url = "ws://localhost:8090/subscriptions"
      val app = Socket
        .collect[WebSocketFrame] {
          case WebSocketFrame.Text("BAZ") => ZStream.succeed(WebSocketFrame.close(1000))
          case frame                      => ZStream.succeed(frame)
        }
        .toSocketApp
        .connect(url) // creates a socket connection on the provided URL

💥 Breaking Changes

  • Rename ClientParams to ClientRequest

      final case class ClientRequest(
        method: Method,
        url: URL,
        getHeaders: Headers = Headers.empty,
        data: HttpData = HttpData.empty,
        private val channelContext: ChannelHandlerContext = null,
      ) extends HeaderExtension[ClientRequest]
  • Drop toZIO and wrapZIO APIs

    private val app =
        Http.collectZIO[Request] {
          case Method.GET -> !! / "greet" / name  => UIO(Response.text(s"Greetings ${name}!"))
        }
  • Rename asString to encode in Scheme

    sealed trait Scheme { self =>
      def encode: String = Scheme.asString(self)
    }
  • Rename getHeaders to headers in ClientRequest

    final case class ClientRequest(
        method: Method,
        url: URL,
        headers: Headers = Headers.empty,
        data: HttpData = HttpData.empty,
        private val channelContext: ChannelHandlerContext = null,
      )
  • Remove get prefix from Public APIs

    Previous Current
    getBodyAsByteBuf bodyAsByteBuf
    getBodyAsString bodyAsString
    getBody body
    getHeaders headers
    getStatus status
    getStatus status
  • Rename asString to encode in URL

    def encode: String = ...
  • silent is removed from Http and HttpApp

Changes

🚀 Features

🐛 Bug Fixes

🧰 Maintenance

New Contributors

Full Changelog: v2.0.0-RC2...v2.0.0-RC3