Documentation
¶
Index ¶
- Constants
- Variables
- type Body
- type CodeCategory
- type Proxy
- func (z Proxy) Alt() Body
- func (z Proxy) Code() int
- func (z Proxy) CodeCategory() CodeCategory
- func (z Proxy) Failure() (error, bool)
- func (z Proxy) Header(header string) string
- func (z Proxy) Headers() map[string]string
- func (z Proxy) IsSuccess() bool
- func (z Proxy) Proto() string
- func (z Proxy) Success() Body
- func (z Proxy) TransportError() error
- type Response
Constants ¶
View Source
const ( Code1xxInformational = 1 Code2xxSuccess = 2 Code3xxRedirection = 3 Code4xxClientErrors = 4 Code5xxServerErrors = 5 )
View Source
const (
MaximumJsonSize = 16 * 1048576 // 16MiB
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body interface {
// Length of the read content in bytes
ContentLength() int64
// Body bytes. Returns empty array if the body written in to the file.
Body() []byte
// Body in string. Returns empty string if the body written into the file.
BodyString() string
// Body file. Return empty string if the body loaded on the memory.
File() string
// True when the body written into the file.
IsFile() bool
// Retrieve body as file. Returns empty string & error if an error happened during write.
AsFile() (string, error)
// Parse body as JSON.
AsJson() (es_json.Json, error)
// Parse body & returns non nil json instance.
Json() es_json.Json
}
type CodeCategory ¶
type CodeCategory int
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy implementation of Response
func (Proxy) CodeCategory ¶
func (z Proxy) CodeCategory() CodeCategory
func (Proxy) TransportError ¶
type Response ¶
type Response interface {
// Status code.
Code() int
// Status code category.
CodeCategory() CodeCategory
// Protocol
Proto() string
// Response headers.
Headers() map[string]string
// Get header value. Ignore cases.
// Returns empty string, if no header found in the response.
Header(header string) string
// True if the content type is text like mime type of text/plain, application/json, etc.
IsTextContentType() bool
// True on the response recognized as success.
IsSuccess() bool
// Returns error & true when the response is an error.
Failure() (error, bool)
// Response body on success.
// Returns empty body when the response is not recognized as success.
Success() Body
// Alternative response body. Returns empty body on success.
Alt() Body
// Error on IO. Returns nil if no errors during the process.
TransportError() error
}
Click to show internal directories.
Click to hide internal directories.