Documentation ¶
Index ¶
- func EscapePath(path string, encodeSep bool) string
- func SplitURI(uri string) (path, query string)
- type Encoder
- func (e *Encoder) AddHeader(key string) HeaderValue
- func (e *Encoder) AddQuery(key string) QueryValue
- func (e *Encoder) Encode(req *http.Request) (*http.Request, error)
- func (e Encoder) HasHeader(key string) bool
- func (e *Encoder) HasQuery(key string) bool
- func (e *Encoder) Headers(prefix string) Headers
- func (e *Encoder) SetHeader(key string) HeaderValue
- func (e *Encoder) SetQuery(key string) QueryValue
- func (e *Encoder) SetURI(key string) URIValue
- type HeaderValue
- func (h HeaderValue) BigDecimal(v *big.Float)
- func (h HeaderValue) BigInteger(v *big.Int)
- func (h HeaderValue) Blob(v []byte)
- func (h HeaderValue) Boolean(v bool)
- func (h HeaderValue) Byte(v int8)
- func (h HeaderValue) Double(v float64)
- func (h HeaderValue) Float(v float32)
- func (h HeaderValue) Integer(v int32)
- func (h HeaderValue) Long(v int64)
- func (h HeaderValue) Short(v int16)
- func (h HeaderValue) String(v string)
- type Headers
- type QueryValue
- func (qv QueryValue) BigDecimal(v *big.Float)
- func (qv QueryValue) BigInteger(v *big.Int)
- func (qv QueryValue) Blob(v []byte)
- func (qv QueryValue) Boolean(v bool)
- func (qv QueryValue) Byte(v int8)
- func (qv QueryValue) Double(v float64)
- func (qv QueryValue) Float(v float32)
- func (qv QueryValue) Integer(v int32)
- func (qv QueryValue) Long(v int64)
- func (qv QueryValue) Short(v int16)
- func (qv QueryValue) String(v string)
- type URIValue
- func (u URIValue) BigDecimal(v *big.Float) error
- func (u URIValue) BigInteger(v *big.Int) error
- func (u URIValue) Boolean(v bool) error
- func (u URIValue) Byte(v int8) error
- func (u URIValue) Double(v float64) error
- func (u URIValue) Float(v float32) error
- func (u URIValue) Integer(v int32) error
- func (u URIValue) Long(v int64) error
- func (u URIValue) Short(v int16) error
- func (u URIValue) String(v string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapePath ¶
EscapePath escapes part of a URL path in Amazon style.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder provides encoding of REST URI path, query, and header components of an HTTP request. Can also encode a stream as the payload.
Does not support SetFields.
func NewEncoder ¶
NewEncoder creates a new encoder from the passed in request. It assumes that raw path contains no valuable information at this point, so it passes in path as path and raw path for subsequent trans
func NewEncoderWithRawPath ¶ added in v1.14.0
NewHTTPBindingEncoder creates a new encoder from the passed in request. All query and header values will be added on top of the request's existing values. Overwriting duplicate values.
func (*Encoder) AddHeader ¶
func (e *Encoder) AddHeader(key string) HeaderValue
AddHeader returns a HeaderValue for appending to the given header name
func (*Encoder) AddQuery ¶
func (e *Encoder) AddQuery(key string) QueryValue
AddQuery returns a QueryValue used for appending the given query key
func (*Encoder) Encode ¶
Encode returns a REST protocol encoder for encoding HTTP bindings.
Due net/http requiring `Content-Length` to be specified on the http.Request#ContentLength directly. Encode will look for whether the header is present, and if so will remove it and set the respective value on http.Request.
Returns any error occurring during encoding.
func (Encoder) HasHeader ¶
HasHeader returns if a header with the key specified exists with one or more value.
func (*Encoder) HasQuery ¶ added in v1.4.0
HasQuery returns if a query with the key specified exists with one or more values.
func (*Encoder) SetHeader ¶
func (e *Encoder) SetHeader(key string) HeaderValue
SetHeader returns a HeaderValue for setting the given header name
func (*Encoder) SetQuery ¶
func (e *Encoder) SetQuery(key string) QueryValue
SetQuery returns a QueryValue used for setting the given query key
type HeaderValue ¶
type HeaderValue struct {
// contains filtered or unexported fields
}
HeaderValue is used to encode values to an HTTP header
func (HeaderValue) BigDecimal ¶
func (h HeaderValue) BigDecimal(v *big.Float)
BigDecimal encodes the value v as a query string value
func (HeaderValue) BigInteger ¶
func (h HeaderValue) BigInteger(v *big.Int)
BigInteger encodes the value v as a query string value
func (HeaderValue) Blob ¶
func (h HeaderValue) Blob(v []byte)
Blob encodes the value v as a base64 header string value
func (HeaderValue) Boolean ¶
func (h HeaderValue) Boolean(v bool)
Boolean encodes the value v as a query string value
func (HeaderValue) Byte ¶
func (h HeaderValue) Byte(v int8)
Byte encodes the value v as a query string value
func (HeaderValue) Double ¶
func (h HeaderValue) Double(v float64)
Double encodes the value v as a query string value
func (HeaderValue) Float ¶
func (h HeaderValue) Float(v float32)
Float encodes the value v as a query string value
func (HeaderValue) Integer ¶
func (h HeaderValue) Integer(v int32)
Integer encodes the value v as the header string value
func (HeaderValue) Long ¶
func (h HeaderValue) Long(v int64)
Long encodes the value v as the header string value
func (HeaderValue) Short ¶
func (h HeaderValue) Short(v int16)
Short encodes the value v as a query string value
func (HeaderValue) String ¶
func (h HeaderValue) String(v string)
String encodes the value v as the header string value
type Headers ¶
type Headers struct {
// contains filtered or unexported fields
}
Headers is used to encode header keys using a provided prefix
func (Headers) AddHeader ¶
func (h Headers) AddHeader(key string) HeaderValue
AddHeader returns a HeaderValue used to append values to prefix+key
func (Headers) SetHeader ¶
func (h Headers) SetHeader(key string) HeaderValue
SetHeader returns a HeaderValue used to set the value of prefix+key
type QueryValue ¶
type QueryValue struct {
// contains filtered or unexported fields
}
QueryValue is used to encode query key values
func NewQueryValue ¶
func NewQueryValue(query url.Values, key string, append bool) QueryValue
NewQueryValue creates a new QueryValue which enables encoding a query value into the given url.Values.
func (QueryValue) BigDecimal ¶
func (qv QueryValue) BigDecimal(v *big.Float)
BigDecimal encodes v as a query string value
func (QueryValue) BigInteger ¶
func (qv QueryValue) BigInteger(v *big.Int)
BigInteger encodes v as a query string value
func (QueryValue) Blob ¶
func (qv QueryValue) Blob(v []byte)
Blob encodes v as a base64 query string value
func (QueryValue) Boolean ¶
func (qv QueryValue) Boolean(v bool)
Boolean encodes v as a query string value
func (QueryValue) Double ¶
func (qv QueryValue) Double(v float64)
Double encodes v as a query string value
func (QueryValue) Float ¶
func (qv QueryValue) Float(v float32)
Float encodes v as a query string value
func (QueryValue) Integer ¶
func (qv QueryValue) Integer(v int32)
Integer encodes v as a query string value
func (QueryValue) Short ¶
func (qv QueryValue) Short(v int16)
Short encodes v as a query string value
func (QueryValue) String ¶
func (qv QueryValue) String(v string)
String encodes v as a query string value
type URIValue ¶
type URIValue struct {
// contains filtered or unexported fields
}
URIValue is used to encode named URI parameters
func (URIValue) BigDecimal ¶
BigDecimal encodes v as a query string value
func (URIValue) BigInteger ¶
BigInteger encodes v as a query string value