#net/http/httputil
Xu 0.13.1 API
import: #net/http/httputil
counts: 3 functions, 1 methods, 1 types, 0 constants, 0 method sets
Package httputil provides HTTP utility functions, complementing the more common ones in net/http. Aligned with `net/http/httputil`.
struct ReverseProxy
pub struct ReverseProxy {
pub target string
pub client http.Client
}
Purpose
Structure encapsulating target, client.
Public fields
target string- field (string)
client http.Client- field (http.Client)
new_single_host_reverse_proxy
pub fn new_single_host_reverse_proxy(target string) ReverseProxy
Purpose
Construct single host reverse proxy.
Parameters
target string- target (string)
Returns
ReverseProxy — a value of this type
($&ReverseProxy) serve_http
pub fn (p $&ReverseProxy) serve_http(c http.Context)
Purpose
Operation on $&ReverseProxy: serve http.
Parameters
p $&ReverseProxy- The
ReverseProxy instance used by this call (exclusive borrow).
c http.Context- byte or character code (http.Context)
Returns
This call does not return a value.
dump_request
pub fn dump_request(c http.Context) string
Purpose
dump_request returns the incoming HTTP request in wire representation.
Parameters
c http.Context- byte or character code (http.Context)
Returns
string — result string
dump_response
pub fn dump_response(resp http.Response) string
Purpose
dump_response returns the HTTP response in wire representation.
Parameters
resp http.Response- resp (http.Response)
Returns
string — result string