Documentation ¶
Overview ¶
Manipulation of the request to the Service.
Index ¶
- type Request
- func (r Request) AddHeader(name string, value string) error
- func (r Request) ClearHeader(name string) error
- func (r Request) SetHeader(name string, value string) error
- func (r Request) SetHeaders(headers map[string][]string) error
- func (r Request) SetMethod(method string) error
- func (r Request) SetPath(path string) error
- func (r Request) SetQuery(query map[string][]string) error
- func (r Request) SetRawBody(body string) error
- func (r Request) SetRawQuery(query string) error
- func (r Request) SetScheme(scheme string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
Holds this module's functions. Accessible as `kong.ServiceRequest`
func (Request) AddHeader ¶
kong.ServiceRequest.AddHeader() adds a request header with the given value to the request to the Service. Unlike kong.ServiceRequest.SetHeader(), this function will not remove any existing headers with the same name. Instead, several occurences of the header will be present in the request. The order in which headers are added is retained.
func (Request) ClearHeader ¶
kong.ServiceRequest.ClearHeader() removes all occurrences of the specified header in the request to the Service.
func (Request) SetHeader ¶
kong.ServiceRequest.SetHeader() sets a header in the request to the Service with the given value. Any existing header with the same name will be overridden.
If the header argument is "host" (case-insensitive), then this will also set the SNI of the request to the Service.
func (Request) SetHeaders ¶
kong.ServiceRequest.SetHeaders() sets the headers of the request to the Service. Unlike kong.ServiceRequest.SetHeader(), the headers argument must be a map in which each key is a string (corresponding to a header’s name), and each value an array of strings.
The resulting headers are produced in lexicographical order. The order of entries with the same name is retained.
This function overrides any existing header bearing the same name as those specified in the headers argument. Other headers remain unchanged.
If the "Host" header is set (case-insensitive), then this is will also set the SNI of the request to the Service.
func (Request) SetMethod ¶
kong.ServiceRequest.SetMethod() sets the HTTP method for the request to the service.
Supported method values are: "GET", "HEAD", "PUT", "POST", "DELETE", "OPTIONS", "MKCOL", "COPY", "MOVE", "PROPFIND", "PROPPATCH", "LOCK", "UNLOCK", "PATCH", "TRACE".
func (Request) SetPath ¶
kong.ServiceRequest.SetPath() sets the path component for the request to the service. It is not normalized in any way and should not include the querystring.
func (Request) SetQuery ¶
kong.ServiceRequest.SetQuery() sets the querystring of the request to the Service.
Unlike kong.ServiceRequest.SetRawQuery(), the query argument must be a map in which each key is a string (corresponding to an arguments name), and each value is either an array of strings or booleans. Additionally, all string values will be URL-encoded.
The resulting querystring will contain keys in their lexicographical order. The order of entries within the same key is retained.
If further control of the querystring generation is needed, a raw querystring can be given as a string with kong.ServiceRequest.SetRawQuery().
func (Request) SetRawBody ¶
kong.ServiceRequest SetRawBody() sets the body of the request to the Service.
The body argument must be a string and will not be processed in any way. This function also sets the Content-Length header appropriately. To set an empty body, one can give an empty string "" to this function.
For a higher-level function to set the body based on the request content type, see kong.ServiceRequest.SetBody().
func (Request) SetRawQuery ¶
kong.ServiceRequest.SetRawQuery() sets the querystring of the request to the Service. The query argument is a string (without the leading ? character), and will not be processed in any way.
For a higher-level function to set the query string from a ???? of arguments, see kong.ServiceRequest.SetQuery().