Skip to content

Commit

Permalink
feat: introduce outgoing-request.into-incoming-request
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Dec 4, 2023
1 parent 7b74a93 commit b641ebf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,18 @@ another component by e.g. <code>outgoing-handler.handle</code>.</p>
<ul>
<li><a name="method_outgoing_request.headers.0"></a> own&lt;<a href="#headers"><a href="#headers"><code>headers</code></a></a>&gt;</li>
</ul>
<h4><a name="static_outgoing_request.into_incoming_request"><code>[static]outgoing-request.into-incoming-request: func</code></a></h4>
<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>.
This allows guests to invoke <code>incoming-handler.handle</code> on other components.
This function will trap if the <a href="#headers"><code>headers</code></a> child is still alive.</p>
<h5>Params</h5>
<ul>
<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>
</ul>
<h5>Return values</h5>
<ul>
<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>
</ul>
<h4><a name="constructor_request_options"><code>[constructor]request-options: func</code></a></h4>
<p>Construct a default <a href="#request_options"><code>request-options</code></a> value.</p>
<h5>Return values</h5>
Expand Down
5 changes: 5 additions & 0 deletions wit/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ interface types {
/// `outgoing-request` is dropped, or its ownership is transfered to
/// another component by e.g. `outgoing-handler.handle`.
headers: func() -> headers;

/// Takes ownership of `outgoing-request`, and returns an `incoming-request`.
/// This allows guests to invoke `incoming-handler.handle` on other components.
/// This function will trap if the `headers` child is still alive.
into-incoming-request: static func(this: outgoing-request) -> incoming-request;
}

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

0 comments on commit b641ebf

Please sign in to comment.