response

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Manipulation of the response from the Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	bridge.PdkBridge
}

Holds this module's functions. Accessible as `kong.ServiceResponse`

func New

func New(ch chan interface{}) Response

Called by the plugin server at initialization.

func (Response) GetHeader

func (r Response) GetHeader(name string) (string, error)

kong.ServiceResponse.GetHeader() returns the value of the specified response header.

Unlike kong.Response.GetHeader(), this function will only return a header if it was present in the response from the Service (ignoring headers added by Kong itself).

func (Response) GetHeaders

func (r Response) GetHeaders(max_headers int) (map[string][]string, error)

kong.ServiceResponse.GetHeaders() returns a map holding the headers from the response from the Service. Keys are header names. Values are either a string with the header value, or an array of strings if a header was sent multiple times. Header names in this table are case-insensitive and dashes (-) can be written as underscores (_); that is, the header X-Custom-Header can also be retrieved as x_custom_header.

Unlike kong.Response.GetHeaders(), this function will only return headers that were present in the response from the Service (ignoring headers added by Kong itself). If the request was not proxied to a Service (e.g. an authentication plugin rejected a request and produced an HTTP 401 response), then the returned headers value might be nil, since no response from the Service has been received.

The max_args argument specifies the maximum number of returned headers. Must be greater than 1 and not greater than 1000, or -1 to specify the default limit of 100 arguments.

func (Response) GetRawBody added in v0.4.0

func (r Response) GetRawBody() (string, error)

kong.ServiceResponse.GetRawBody() returns the raw body of the response from the Service.

func (Response) GetStatus

func (r Response) GetStatus() (i int, err error)

kong.ServiceResponse.GetStatus() returns the HTTP status code of the response from the Service as an integer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL