diff --git a/readme.md b/readme.md index 80677de..2a1526b 100644 --- a/readme.md +++ b/readme.md @@ -24,6 +24,8 @@ Please see the [project releases](https://socketry.github.io/protocol-http/relea ### Unreleased + - [`Request[]` and `Response[]` Keyword Arguments](https://socketry.github.io/protocol-http/releases/index#request[]-and-response[]-keyword-arguments) + ## See Also - [protocol-http1](https://github.com/socketry/protocol-http1) — HTTP/1 client/server implementation using this diff --git a/releases.md b/releases.md index eaa230e..64df916 100644 --- a/releases.md +++ b/releases.md @@ -1,3 +1,17 @@ # Releases ## Unreleased + +### `Request[]` and `Response[]` Keyword Arguments + +The `Request[]` and `Response[]` methods now support keyword arguments as a convenient way to set various positional arguments. + +```ruby +# Request keyword arguments: +client.get("/", headers: {"accept" => "text/html"}, authority: "example.com") + +# Response keyword arguments: +def call(request) + return Response[200, headers: {"content-Type" => "text/html"}, body: "Hello, World!"] +end +```