@@ -72,10 +72,7 @@ pub trait Context {
72
72
///
73
73
/// # Returns
74
74
///
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.
79
76
///
80
77
/// # Example
81
78
///
@@ -130,13 +127,13 @@ pub trait Context {
130
127
hostcalls:: dispatch_http_call ( upstream, headers, body, trailers, timeout)
131
128
}
132
129
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.
134
131
///
135
132
/// If `num_headers` is 0, then the HTTP call failed.
136
133
///
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 )`.
138
135
///
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 )`.
140
137
///
141
138
/// # Arguments
142
139
///
@@ -640,7 +637,7 @@ pub trait HttpContext: Context {
640
637
///
641
638
/// Paused request can be resumed using `self.resume_http_request()` or closed using `self.reset_http_request()`.
642
639
///
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()`.
644
641
///
645
642
/// # Arguments
646
643
///
@@ -722,7 +719,7 @@ pub trait HttpContext: Context {
722
719
hostcalls:: set_map_bytes ( MapType :: HttpRequestHeaders , headers) . unwrap ( )
723
720
}
724
721
725
- /// Get a specific HTTP request header.
722
+ /// Get a specific HTTP request header by name .
726
723
///
727
724
/// # Arguments
728
725
///
@@ -973,9 +970,9 @@ pub trait HttpContext: Context {
973
970
hostcalls:: reset_http_response ( ) . unwrap ( )
974
971
}
975
972
976
- /// Sends an HTTP response with the body and serialized headers.
973
+ /// Sends an HTTP response with the specified status code, headers, and body .
977
974
///
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 .
979
976
///
980
977
/// # Arguments
981
978
///
@@ -1000,7 +997,7 @@ pub trait HttpContext: Context {
1000
997
/// // Send an HTTP response with a status code of 200 and a body of "Hello, World!"
1001
998
/// self.send_http_response(200, vec![("A header", "Some Value")], Some(b"Hello, World!"));
1002
999
/// } 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"
1004
1001
/// self.send_http_response(307, vec![("location", "https://authenticate-here.com")], Some(b"Forbidden"));
1005
1002
/// }
1006
1003
///
0 commit comments