Skip to content

Commit 980105d

Browse files
authored
Add changelog (#228)
1 parent 5dee70c commit 980105d

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

Diff for: CHANGES.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
# 0.19.0
2+
3+
This release is a complete rewrite of the Opium's internal that switches from Cohttp to Httpaf.
4+
As demonstrated in several benchmarks, Httpaf's latency is much lower than Cohttp's in stress tests, so it is expected that Opium will perform better in these high pressure situations with this change.
5+
6+
The underlying HTTP server implementation is now contained in the `rock` package, that provides a Service and Filter implementation, inspired by Finagle's. The architecture is similar to Ruby's Rack library (hence the name), so one can compose complex web applications by combining Rock applications.
7+
8+
The `rock` package offers a very slim API, with very few dependencies, so it should be an attractive option for other Web framework to build on, which would allow the re-usability of middlewares and handlers, independently of the framework used (e.g. one could use Sihl middlewares with Opium, and vice versa).
9+
10+
Apart from the architectural changes, this release comes with a lot of additionnal utilities and middlewares which should make Opium a better candidate for complex web applications, without having to re-write a lot of common Web server functionnalities.
11+
12+
The Request and Response modules now provide:
13+
14+
- JSON encoders/decoders with `Yojson`
15+
- HTML encoders/decoders with `Tyxml`
16+
- XML encoders/decoders with `Tyxml`
17+
- SVG encoders/decoders with `Tyxml`
18+
- multipart/form encoders/decoders with `multipart_form_data`
19+
- urlencoded encoders/decoders with `Uri`
20+
21+
And the following middlewares are now built-in:
22+
23+
- `debugger` to display an HTML page with the errors in case of failures
24+
- `logger` to log requests and responses, with a timer
25+
- `allow_cors` to add CORS headers
26+
- `static` to serve static content given a custom read function (e.g. read from S3)
27+
- `static_unix` to to serve static content from the local filesystem
28+
- `content_length` to add the `Content-Length` header to responses
29+
- `method_override` to replace the HTTP method with the one found in the `_method` field of `application/x-www-form-urlencoded` encoded `POST` requests.
30+
- `etag` to add `ETag` header to the responses and send an HTTP code `304` when the computed ETag matches the one specified in the request.
31+
- `method_required` to filter the requests by method and respond with an HTTP code `405` if the method is not allowed.
32+
- `head` to add supports for `HEAD` request for handlers that receive `GET` requests.
33+
34+
Lastly, this release also adds a package `opium-testing` that can be used to test Opium applications with `Alcotest`. It provides `Testable` modules for every Opium types, and implements helper functions to easily get an `Opium.Response` from an `Opium.Request`.
35+
136
# 0.18.0
237

338
* Make examples easier to find and add documentation related to features used in them. (#125, @shonfeder)

Diff for: opium/src/opium.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ module Middleware : sig
202202
(** {3 [method_required]} *)
203203

204204
(** [method_required] creates a middleware that filters the requests by method and
205-
respond with a [`Method_not_allowed] status ([HTTP 304]) if the method is not
205+
respond with a [`Method_not_allowed] status ([HTTP 405]) if the method is not
206206
allowed. *)
207207
val method_required : ?allowed_methods:Method.t list -> unit -> Rock.Middleware.t
208208

0 commit comments

Comments
 (0)