github finagle/finch 0.18.0
Finch 0.18

latest releases: v0.34.1, v0.34.0, v0.33.0...
6 years ago

A new Finch release against Finagle 18.3.

Improved compile times

Georgi Krastev (@joroKr21) in #924 quite dramatically improved compilation time of coproduct endpoints. He and @rpless reported improvements 4m -> 6s and 140s -> 70s respectively. These are quite outstanding improvements given how local and minimal the change is.

MethodNotAllowed support

More than a year ago we started talking about automatically supporting 405 MethodNotAllowed for the cases when an endpoint matches but for a different method. Sergey Kolbasov (@sergeykolbasov) gave it a shot in #883 and later myself iterated on it in #927 such that we also compliant with RFC 2016, Section 10.

The new behavior is disabled by default but you can easily opt-in for 405 support via a new Bootstrap option.

scala> val foo = get("foo") { Ok("foo") }
foo: io.finch.Endpoint[String] = GET /foo

scala> val s = Bootstrap
  .configure(enableMethodNotAllowed = true)
  .serve[Text.Plain](foo)
  .toService
s: com.twitter.finagle.Service[com.twitter.finagle.http.Request,com.twitter.finagle.http.Response] = <function1>

scala> Http.server.serve(":8081", s)

And then (note the Allow header derived automatically):

$ http GET :8081/foo
HTTP/1.1 200 OK
Content-Type: text/plain
Date: Sun, 18 Mar 2018 21:09:02 GMT
Server: Finch
content-encoding: gzip
content-length: 29

foo

$ http PUT :8081/foo
HTTP/1.1 405 Method Not Allowed
Allow: GET
Content-Length: 0
Date: Sun, 18 Mar 2018 21:09:05 GMT
Server: Finch

Other changes

Don't miss a new finch release

NewReleases is sending notifications on new releases.