Sha256: 02eadd3dadf9c29903dfcec4e08f42e11976e117bac1a37360fc342108d4e441
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# 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!"] ``` ### Interim Response Handling The `Request` class now exposes a `#interim_response` attribute which can be used to handle interim responses both on the client side and server side. On the client side, you can pass a callback using the `interim_response` keyword argument which will be invoked whenever an interim response is received: ```ruby client = ... response = client.get("/index", interim_response: proc{|status, headers| ...}) ``` On the server side, you can send an interim response using the `#send_interim_response` method: ```ruby def call(request) if request.headers["expect"] == "100-continue" # Send an interim response: request.send_interim_response(100) end # ... end ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
protocol-http-0.30.0 | releases.md |