XU XUv0.13.1
中文

#net/http/httputil

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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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