http

package
v3.12.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGinConfig

func GetGinConfig(c *check.C) *ogin.GinConfig

func GetWebHost

func GetWebHost() string

func GetWebPort

func GetWebPort() uint16

func GetWebUrl

func GetWebUrl() string

func HasWebConfigOrSkip

func HasWebConfigOrSkip(c *check.C) bool

func StartGinWebServer

func StartGinWebServer(c *check.C, engineFunc GinEngineConfigFunc)

Types

type CheckSlint

type CheckSlint struct {
	Slint        *sling.Sling
	LastResponse *http.Response
	// contains filtered or unexported fields
}

Slint with checker

func NewCheckSlint

func NewCheckSlint(checker *checker.C, sling *sling.Sling) *CheckSlint

Initialize a checker with slint support

func (*CheckSlint) AssertHasPaging

func (self *CheckSlint) AssertHasPaging()

Asserts the existing of paging header

func (*CheckSlint) GetJsonBody

func (self *CheckSlint) GetJsonBody(expectedStatus int) *json.Json

Gets body as JSON

The exepcted status is used to get expected status

func (*CheckSlint) GetResponse

func (self *CheckSlint) GetResponse() *http.Response

Gets the response for current request

func (*CheckSlint) GetStringBody

func (self *CheckSlint) GetStringBody(expectedStatus int) string

Gets body as string

The exepcted status is used to get expected status

func (*CheckSlint) Request

func (self *CheckSlint) Request() *http.Request

Gets request of slint

type GinEngineConfigFunc

type GinEngineConfigFunc func(*gin.Engine)

type HttpClientConfig

type HttpClientConfig struct {
	Ssl      bool
	Host     string
	Port     uint16
	Resource string
	// contains filtered or unexported fields
}

The configuration of http client

func NewHttpClientConfigByFlag

func NewHttpClientConfigByFlag() *HttpClientConfig

Initialize a client config by flag

http_host - host name of http service
http_port - port of http service
http_ssl - whether or not use SSL to test http service

func (*HttpClientConfig) NewSlingByBase

func (self *HttpClientConfig) NewSlingByBase() *sling.Sling

func (*HttpClientConfig) String

func (self *HttpClientConfig) String() string

Gets the full URL of tested service

type ResponseResult

type ResponseResult struct {
	Response *http.Response
	// contains filtered or unexported fields
}

func NewResponseResultByRequest

func NewResponseResultByRequest(req *http.Request) *ResponseResult

Performs request and reads the body into []byte

func NewResponseResultByResponse

func NewResponseResultByResponse(resp *http.Response) *ResponseResult

func NewResponseResultBySling

func NewResponseResultBySling(slingObj *sling.Sling) *ResponseResult

Performs request and reads the body into []byte

func (*ResponseResult) GetBodyAsJson

func (r *ResponseResult) GetBodyAsJson() *json.Json

func (*ResponseResult) GetBodyAsString

func (r *ResponseResult) GetBodyAsString() string

Jump to

Keyboard shortcuts

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