utils

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareObjectMeta added in v1.2.0

func CompareObjectMeta(c1, c2 api.ObjectMeta) bool

CompareObjectMeta will loosly determine whether two ObjectMeta objects are equal. It does this by comparing the name and namespace

func ComputeTargetPath

func ComputeTargetPath(proxyPath, proxyTarget, requestPath string) string

ComputeTargetPath calcuates the target or destination path based on the incoming path, desired target path prefix and the assicated proxy

func ComputeURLPath added in v1.2.1

func ComputeURLPath(u *url.URL) string

ComputeURLPath will correct a URL path that might be valid but not ideally formatted

func GetAbsPath

func GetAbsPath(path string) (string, error)

GetAbsPath returns the absolute path given any path the returned path is in a form that Kanali prefers

func NormalizeURLPath added in v1.2.1

func NormalizeURLPath(path string) string

NormalizeURLPath will normalize any string treating it like a URL path.

Types

type Error

type Error interface {
	error
	Status() int
}

Error is an interface that is used to intuitively handle HTTP errors. It expands on the native error interface that the language provides

type JSONErr

type JSONErr struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

JSONErr is used to assist in marshalling HTTP errors

type StatusError

type StatusError struct {
	Code int
	Err  error
}

StatusError implements the Error interface and is used to handle HTTP specific errors

func (StatusError) Error

func (se StatusError) Error() string

Error will return the error message associated with the error

func (StatusError) Status

func (se StatusError) Status() int

Status returns the HTTP error code associated with the error

Jump to

Keyboard shortcuts

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