Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b641ebf

Browse files
committedDec 4, 2023
feat: introduce outgoing-request.into-incoming-request
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
1 parent 7b74a93 commit b641ebf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎proxy.md

+12
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,18 @@ another component by e.g. <code>outgoing-handler.handle</code>.</p>
10321032
<ul>
10331033
<li><a name="method_outgoing_request.headers.0"></a> own&lt;<a href="#headers"><a href="#headers"><code>headers</code></a></a>&gt;</li>
10341034
</ul>
1035+
<h4><a name="static_outgoing_request.into_incoming_request"><code>[static]outgoing-request.into-incoming-request: func</code></a></h4>
1036+
<p>Takes ownership of <a href="#outgoing_request"><code>outgoing-request</code></a>, and returns an <a href="#incoming_request"><code>incoming-request</code></a>.
1037+
This allows guests to invoke <code>incoming-handler.handle</code> on other components.
1038+
This function will trap if the <a href="#headers"><code>headers</code></a> child is still alive.</p>
1039+
<h5>Params</h5>
1040+
<ul>
1041+
<li><a name="static_outgoing_request.into_incoming_request.this"><code>this</code></a>: own&lt;<a href="#outgoing_request"><a href="#outgoing_request"><code>outgoing-request</code></a></a>&gt;</li>
1042+
</ul>
1043+
<h5>Return values</h5>
1044+
<ul>
1045+
<li><a name="static_outgoing_request.into_incoming_request.0"></a> own&lt;<a href="#incoming_request"><a href="#incoming_request"><code>incoming-request</code></a></a>&gt;</li>
1046+
</ul>
10351047
<h4><a name="constructor_request_options"><code>[constructor]request-options: func</code></a></h4>
10361048
<p>Construct a default <a href="#request_options"><code>request-options</code></a> value.</p>
10371049
<h5>Return values</h5>

‎wit/types.wit

+5
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,11 @@ interface types {
306306
/// `outgoing-request` is dropped, or its ownership is transfered to
307307
/// another component by e.g. `outgoing-handler.handle`.
308308
headers: func() -> headers;
309+
310+
/// Takes ownership of `outgoing-request`, and returns an `incoming-request`.
311+
/// This allows guests to invoke `incoming-handler.handle` on other components.
312+
/// This function will trap if the `headers` child is still alive.
313+
into-incoming-request: static func(this: outgoing-request) -> incoming-request;
309314
}
310315

311316
/// Parameters for making an HTTP Request. Each of these parameters is

0 commit comments

Comments
 (0)
Please sign in to comment.