func EscapePath(path string, encodeSep bool) string
EscapePath escapes part of a URL path in Amazon style.
func SplitURI(uri string) (path, query string)
SplitURI parses a Smithy HTTP binding trait URI
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.
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder(path, query string, headers http.Header) (*Encoder, error)
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(path, rawPath, query string, headers http.Header) (*Encoder, error)
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 (e *Encoder) AddHeader(key string) HeaderValue
AddHeader returns a HeaderValue for appending to the given header name
func (e *Encoder) AddQuery(key string) QueryValue
AddQuery returns a QueryValue used for appending the given query key
func (e *Encoder) Encode(req *http.Request) (*http.Request, error)
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 (e Encoder) HasHeader(key string) bool
HasHeader returns if a header with the key specified exists with one or more value.
func (e *Encoder) HasQuery(key string) bool
HasQuery returns if a query with the key specified exists with one or more values.
func (e *Encoder) Headers(prefix string) Headers
Headers returns a Header used for encoding headers with the given prefix
func (e *Encoder) SetHeader(key string) HeaderValue
SetHeader returns a HeaderValue for setting the given header name
func (e *Encoder) SetQuery(key string) QueryValue
SetQuery returns a QueryValue used for setting the given query key
func (e *Encoder) SetURI(key string) URIValue
SetURI returns a URIValue used for setting the given path key
HeaderValue is used to encode values to an HTTP header
type HeaderValue struct {
// contains filtered or unexported fields
}
func (h HeaderValue) BigDecimal(v *big.Float)
BigDecimal encodes the value v as a query string value
func (h HeaderValue) BigInteger(v *big.Int)
BigInteger encodes the value v as a query string value
func (h HeaderValue) Blob(v []byte)
Blob encodes the value v as a base64 header string value
func (h HeaderValue) Boolean(v bool)
Boolean encodes the value v as a query string value
func (h HeaderValue) Byte(v int8)
Byte encodes the value v as a query string value
func (h HeaderValue) Double(v float64)
Double encodes the value v as a query string value
func (h HeaderValue) Float(v float32)
Float encodes the value v as a query string value
func (h HeaderValue) Integer(v int32)
Integer encodes the value v as the header string value
func (h HeaderValue) Long(v int64)
Long encodes the value v as the header string value
func (h HeaderValue) Short(v int16)
Short encodes the value v as a query string value
func (h HeaderValue) String(v string)
String encodes the value v as the header string value
Headers is used to encode header keys using a provided prefix
type Headers struct {
// contains filtered or unexported fields
}
func (h Headers) AddHeader(key string) HeaderValue
AddHeader returns a HeaderValue used to append values to prefix+key
func (h Headers) SetHeader(key string) HeaderValue
SetHeader returns a HeaderValue used to set the value of prefix+key
QueryValue is used to encode query key values
type QueryValue struct {
// contains filtered or unexported fields
}
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 (qv QueryValue) BigDecimal(v *big.Float)
BigDecimal encodes v as a query string value
func (qv QueryValue) BigInteger(v *big.Int)
BigInteger encodes v as a query string value
func (qv QueryValue) Blob(v []byte)
Blob encodes v as a base64 query string value
func (qv QueryValue) Boolean(v bool)
Boolean encodes v as a query string value
func (qv QueryValue) Byte(v int8)
Byte encodes v as a query string value
func (qv QueryValue) Double(v float64)
Double encodes v as a query string value
func (qv QueryValue) Float(v float32)
Float encodes v as a query string value
func (qv QueryValue) Integer(v int32)
Integer encodes v as a query string value
func (qv QueryValue) Long(v int64)
Long encodes v as a query string value
func (qv QueryValue) Short(v int16)
Short encodes v as a query string value
func (qv QueryValue) String(v string)
String encodes v as a query string value
URIValue is used to encode named URI parameters
type URIValue struct {
// contains filtered or unexported fields
}
func (u URIValue) BigDecimal(v *big.Float) error
BigDecimal encodes v as a query string value
func (u URIValue) BigInteger(v *big.Int) error
BigInteger encodes v as a query string value
func (u URIValue) Boolean(v bool) error
Boolean encodes v as a URI string value
func (u URIValue) Byte(v int8) error
Byte encodes v as a URI string value
func (u URIValue) Double(v float64) error
Double encodes v as a query string value
func (u URIValue) Float(v float32) error
Float encodes v as a query string value
func (u URIValue) Integer(v int32) error
Integer encodes v as a URI string value
func (u URIValue) Long(v int64) error
Long encodes v as a URI string value
func (u URIValue) Short(v int16) error
Short encodes v as a URI string value
func (u URIValue) String(v string) error
String encodes v as a URI string value