diff --git a/docker/stallion/corral.json b/docker/stallion/corral.json index 6e3e0c3..72bd32e 100644 --- a/docker/stallion/corral.json +++ b/docker/stallion/corral.json @@ -2,7 +2,7 @@ "deps": [ { "locator": "github.com/ponylang/stallion.git", - "version": "0.6.1" + "version": "0.7.0" } ] } diff --git a/docker/stallion/main.pony b/docker/stallion/main.pony index 89acf77..084c2d1 100644 --- a/docker/stallion/main.pony +++ b/docker/stallion/main.pony @@ -59,11 +59,18 @@ actor OkServer is stallion.HTTPServerActor request': stallion.Request val, responder: stallion.Responder) => + // Per RFC 9110 ยง9.3.2 the application is responsible for not + // emitting a body when the request method is HEAD. The headers + // (including Content-Length) match what a GET would produce; only + // the body section is suppressed. let body: String val = "ok\n" - let response = stallion.ResponseBuilder(stallion.StatusOK) + let builder = stallion.ResponseBuilder(stallion.StatusOK) .add_header("Content-Type", "text/plain") .add_header("Content-Length", body.size().string()) .finish_headers() - .add_chunk(body) - .build() + let response = + match request'.method + | stallion.HEAD => builder.build() + else builder.add_chunk(body).build() + end responder.respond(response)