-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
# Releases | ||
|
||
## Unreleased | ||
|
||
### 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) | ||
body = Body::Writable.new | ||
|
||
# Send an interim response: | ||
request.send_interim_response(100, {}) | ||
|
||
return Response[200, headers, body] | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters