istio: Index | Files

package client

import ""


Package Files

client.go parsedresponse.go


var (
    URLFieldRegex = regexp.MustCompile(string(response.URLField) + "=(.*)")

type Instance Uses

type Instance struct {
    // contains filtered or unexported fields

Instance is a client of an Echo server that simplifies request/response processing for Forward commands.

func New Uses

func New(address string, tlsSettings *common.TLSSettings) (*Instance, error)

New creates a new echo client.Instance that is connected to the given server address.

func (*Instance) Close Uses

func (c *Instance) Close() error

Close the EchoClient and free any resources.

func (*Instance) ForwardEcho Uses

func (c *Instance) ForwardEcho(ctx context.Context, request *proto.ForwardEchoRequest) (ParsedResponses, error)

ForwardEcho sends the given forward request and parses the response for easier processing. Only fails if the request fails.

type ParsedResponse Uses

type ParsedResponse struct {
    // Body is the body of the response
    Body string
    // ID is a unique identifier of the resource in the response
    ID  string
    // URL is the url the request is sent to
    URL string
    // Version is the version of the resource in the response
    Version string
    // Port is the port of the resource in the response
    Port string
    // Code is the response code
    Code string
    // Host is the host called by the request
    Host string
    // Hostname is the host that responded to the request
    Hostname string
    // RawResponse gives a map of all values returned in the response (headers, etc)
    RawResponse map[string]string

ParsedResponse represents a response to a single echo request.

func (*ParsedResponse) Count Uses

func (r *ParsedResponse) Count(text string) int

Count occurrences of the given text within the body of this response.

func (*ParsedResponse) IsOK Uses

func (r *ParsedResponse) IsOK() bool

IsOK indicates whether or not the code indicates a successful request.

type ParsedResponses Uses

type ParsedResponses []*ParsedResponse

ParsedResponses is an ordered list of parsed response objects.

func (ParsedResponses) Check Uses

func (r ParsedResponses) Check(check func(int, *ParsedResponse) error) (err error)

func (ParsedResponses) CheckHost Uses

func (r ParsedResponses) CheckHost(expected string) error

func (ParsedResponses) CheckHostOrFail Uses

func (r ParsedResponses) CheckHostOrFail(t test.Failer, expected string) ParsedResponses

func (ParsedResponses) CheckOK Uses

func (r ParsedResponses) CheckOK() error

func (ParsedResponses) CheckOKOrFail Uses

func (r ParsedResponses) CheckOKOrFail(t test.Failer) ParsedResponses

func (ParsedResponses) CheckOrFail Uses

func (r ParsedResponses) CheckOrFail(t test.Failer, check func(int, *ParsedResponse) error) ParsedResponses

func (ParsedResponses) CheckPort Uses

func (r ParsedResponses) CheckPort(expected int) error

func (ParsedResponses) CheckPortOrFail Uses

func (r ParsedResponses) CheckPortOrFail(t test.Failer, expected int) ParsedResponses

func (ParsedResponses) Count Uses

func (r ParsedResponses) Count(text string) int

Count occurrences of the given text within the bodies of all responses.

func (ParsedResponses) Len Uses

func (r ParsedResponses) Len() int

Len returns the length of the parsed responses.

Package client imports 15 packages (graph) and is imported by 8 packages. Updated 2020-04-01. Refresh now. Tools for package owners.