@@ -72,10 +72,7 @@ pub trait Context {
7272 ///
7373 /// # Returns
7474 ///
75- /// * `OK` on success.
76- /// * `BAD_ARGUMENT` for unknown upstream, or when headers are missing required `:authority`, `:method` and/or `:path` values.
77- /// * `INTERNAL_FAILURE' when the host failed to send requested HTTP call.
78- /// * `INVALID_MEMORY_ACCESS` when `upstream_data`, `upstream_size`, `headers_data`, `headers_size`, `body_data`, `body_size`, `trailers_data`, `trailers_size` and/or `return_call_id` point to invalid memory address.
75+ /// A Result containing the token id of the request, or an error status.
7976 ///
8077 /// # Example
8178 ///
@@ -130,13 +127,13 @@ pub trait Context {
130127 hostcalls:: dispatch_http_call ( upstream, headers, body, trailers, timeout)
131128 }
132129
133- /// Called when HTTP response for call_id sent using proxy_http_call is received.
130+ /// Called when HTTP response using `dispatch_http_call` is received.
134131 ///
135132 /// If `num_headers` is 0, then the HTTP call failed.
136133 ///
137- /// All `num_headers` headers can be retrieved using `self.get_http_response_headers()` or individually `self.get_http_response_header()`.
134+ /// All headers can be retrieved using `self.get_http_response_headers()` or individually `self.get_http_response_header(name )`.
138135 ///
139- /// All `num_trailers` trailers can be retrieved using `self.get_http_response_trailers()` or individually `self.get_http_response_trailer()`.
136+ /// All trailers can be retrieved using `self.get_http_response_trailers()` or individually `self.get_http_response_trailer(name )`.
140137 ///
141138 /// # Arguments
142139 ///
@@ -640,7 +637,7 @@ pub trait HttpContext: Context {
640637 ///
641638 /// Paused request can be resumed using `self.resume_http_request()` or closed using `self.reset_http_request()`.
642639 ///
643- /// Additionally, instead of forwarding request upstream, a HTTP response can be sent using `self.send_http_response()`.
640+ /// Additionally, instead of forwarding requests upstream, a HTTP response can be sent using `self.send_http_response()`.
644641 ///
645642 /// # Arguments
646643 ///
@@ -722,7 +719,7 @@ pub trait HttpContext: Context {
722719 hostcalls:: set_map_bytes ( MapType :: HttpRequestHeaders , headers) . unwrap ( )
723720 }
724721
725- /// Get a specific HTTP request header.
722+ /// Get a specific HTTP request header by name .
726723 ///
727724 /// # Arguments
728725 ///
@@ -973,9 +970,9 @@ pub trait HttpContext: Context {
973970 hostcalls:: reset_http_response ( ) . unwrap ( )
974971 }
975972
976- /// Sends an HTTP response with the body and serialized headers.
973+ /// Sends an HTTP response with the specified status code, headers, and body .
977974 ///
978- /// This can be used as long as HTTP response headers were not sent downstream.
975+ /// This can be used as long as HTTP response headers were not sent downstream yet .
979976 ///
980977 /// # Arguments
981978 ///
@@ -1000,7 +997,7 @@ pub trait HttpContext: Context {
1000997 /// // Send an HTTP response with a status code of 200 and a body of "Hello, World!"
1001998 /// self.send_http_response(200, vec![("A header", "Some Value")], Some(b"Hello, World!"));
1002999 /// } else {
1003- /// // Send an HTTP response with a status code of 403 and a body of "Forbidden"
1000+ /// // Send an HTTP response with a status code of 307, redirecting to authenticate-here.com, and a body of "Forbidden"
10041001 /// self.send_http_response(307, vec![("location", "https://authenticate-here.com")], Some(b"Forbidden"));
10051002 /// }
10061003 ///
0 commit comments