testproxyhelpers

package
v0.0.0-...-d879545 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetEndpoint            = "/api/v1/check_get"
	PostEndpoint           = "/api/v1/check_post"
	PutEndpoint            = "/api/v1/check_put"
	DefaultFakeServiceHost = "localhost:10000"
	DefaultFakeServiceURL  = "http://" + DefaultFakeServiceHost
	DefaultGetAnswer       = "it's a get request"
	DefaultPostAnswer      = "it's a post request"
	DefaultPutAnswer       = "it's a put request"
)
View Source
const (
	DefaultFakeCaptchaHost     = "localhost:10002"
	DefaultFakeCaptchaURL      = "http://" + DefaultFakeCaptchaHost
	DefaultFakeCaptchaEndpoint = "/siteverify"
	DefaultFakeCaptchaKey      = "captcha_key"
	DefaultFakeGoodCaptcha     = "good_captcha"
	DefaultFakeBadCaptcha      = "bad_captcha"
	DefaultFakeCaptchaSign     = "test_sign"
)
View Source
const (
	DefaultFakeIntrospectorHost           = "localhost:10001"
	DefaultFakeIntrospectorURL            = "http://" + DefaultFakeIntrospectorHost
	DefaultFakeIntrospectorEndpoint       = "/oauth2/introspect"
	DefaultFakeIntrospectorContentType    = "application/x-www-form-urlencoded"
	DefaultFakeIntrospectorMethod         = "POST"
	DefaultFakeIntrospectorValidMarker    = `"active":true`
	DefaultFakeIntrospectorBodyTemplate   = `token_type_hint=access_token&token={{.Token}}`
	DefaultFakeIntrospectorCookieName     = "access-token"
	DefaultFakeIntrospectorQueryParamName = "access_token"
	DefaultFakeIntrospectorHeaderName     = "authorization"

	TestToken = "goodToken"
	BadToken  = "badToken"
)
View Source
const (
	ContentTypeFormUrlencoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func DefaultFakeIntrospectorCookiesName

func DefaultFakeIntrospectorCookiesName() []string

func DefaultFakeIntrospectorHeadersName

func DefaultFakeIntrospectorHeadersName() []string

func DefaultFakeIntrospectorQueryParamsName

func DefaultFakeIntrospectorQueryParamsName() []string

func DefaultHeader

func DefaultHeader() http.Header

func FakeBackendService

func FakeBackendService(t *testing.T, host string) *httptest.Server

func FakeCaptchaService

func FakeCaptchaService(t *testing.T, host string) *httptest.Server

func FakeIntrospectorService

func FakeIntrospectorService(t *testing.T, host string) *httptest.Server

func FakeService

func FakeService(t *testing.T, host string, handler http.Handler) *httptest.Server

Types

type GoogleRecaptchaResponse

type GoogleRecaptchaResponse struct {
	Success            bool     `json:"success"`
	ChallengeTimestamp string   `json:"challenge_ts"`
	Hostname           string   `json:"hostname"`
	ErrorCodes         []string `json:"error-codes"`
}

type HTTPBody

type HTTPBody struct {
	Result struct {
		Message   string    `json:"message"`
		TimeStamp time.Time `json:"timestamp"`
		UUID      uuid.UUID `json:"uuid"`
	} `json:"result"`
}

func NewResponse

func NewResponse(msg string) *HTTPBody

Jump to

Keyboard shortcuts

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