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
- circe-jackson dependency was removed, use standard Circe's printers instead (see #916)
- finch-jackson is extracted into its own project, https://github.com/finch/finch-jackson (see #920)
- path extracting endpoints now apply URL-decoding (see #917, thanks @sergeykolbasov)
- there are new content types defined out of the box (see #918, thanks @muuki88)