Documentation ¶
Index ¶
- Constants
- func ParseQueryString(query string) types.QueryParams
- type Code
- type RequestHeader
- func (h RequestHeader) Add(key, value string)
- func (h RequestHeader) ByteSize() (size uint64)
- func (h RequestHeader) Clone() types.HeaderMap
- func (h RequestHeader) Del(key string)
- func (h RequestHeader) Get(key string) (string, bool)
- func (h RequestHeader) Range(f func(key, value string) bool)
- func (h RequestHeader) Set(key string, value string)
- type ResponseHeader
- func (h ResponseHeader) Add(key, value string)
- func (h ResponseHeader) ByteSize() (size uint64)
- func (h ResponseHeader) Clone() types.HeaderMap
- func (h ResponseHeader) Del(key string)
- func (h ResponseHeader) Get(key string) (string, bool)
- func (h ResponseHeader) Range(f func(key, value string) bool)
- func (h ResponseHeader) Set(key string, value string)
Constants ¶
const ( Continue Code = 100 OK = 200 Created = 201 Accepted = 202 NonAuthoritativeInformation = 203 NoContent = 204 ResetContent = 205 PartialContent = 206 MultiStatus = 207 AlreadyReported = 208 IMUsed = 226 MultipleChoices = 300 MovedPermanently = 301 Found = 302 SeeOther = 303 NotModified = 304 UseProxy = 305 TemporaryRedirect = 307 PermanentRedirect = 308 BadRequest = 400 PaymentRequired = 402 Forbidden = 403 NotFound = 404 MethodNotAllowed = 405 NotAcceptable = 406 ProxyAuthenticationRequired = 407 RequestTimeout = 408 Conflict = 409 Gone = 410 LengthRequired = 411 PreconditionFailed = 412 PayloadTooLarge = 413 URITooLong = 414 UnsupportedMediaType = 415 RangeNotSatisfiable = 416 ExpectationFailed = 417 MisdirectedRequest = 421 UnprocessableEntity = 422 Locked = 423 FailedDependency = 424 UpgradeRequired = 426 PreconditionRequired = 428 TooManyRequests = 429 RequestHeaderFieldsTooLarge = 431 InternalServerError = 500 NotImplemented = 501 BadGateway = 502 GatewayTimeout = 504 HTTPVersionNotSupported = 505 VariantAlsoNegotiates = 506 InsufficientStorage = 507 LoopDetected = 508 NotExtended = 510 NetworkAuthenticationRequired = 511 PlaceHolder = "-" )
Variables ¶
This section is empty.
Functions ¶
func ParseQueryString ¶
func ParseQueryString(query string) types.QueryParams
the query string looks like: "field1=value1&field2=value2&field3=value3..."
Types ¶
type RequestHeader ¶
type RequestHeader struct {
*fasthttp.RequestHeader
}
func (RequestHeader) Add ¶
func (h RequestHeader) Add(key, value string)
Add value for given key. Multiple headers with the same key may be added with this function. Use Set for setting a single header for the given key.
func (RequestHeader) ByteSize ¶
func (h RequestHeader) ByteSize() (size uint64)
func (RequestHeader) Clone ¶
func (h RequestHeader) Clone() types.HeaderMap
func (RequestHeader) Range ¶
func (h RequestHeader) Range(f func(key, value string) bool)
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
func (RequestHeader) Set ¶
func (h RequestHeader) Set(key string, value string)
Set key-value pair in header map, the previous pair will be replaced if exists
Due to the fact that fasthttp's implementation doesn't have correct semantic for Set("key", "") and Peek("key") at the first time of usage. We need another way for compensate.
The problem is caused by the func initHeaderKV, if the original kv.value is nil, ant input value is also nil, then the final kv.value remains nil.
kv.value = append(kv.value[:0], value...)
fasthttp do has the kv entry, but kv.value is nil, so Peek("key") return nil. But we want "" instead.
type ResponseHeader ¶
type ResponseHeader struct {
*fasthttp.ResponseHeader
}
func (ResponseHeader) Add ¶
func (h ResponseHeader) Add(key, value string)
Add value for given key. Multiple headers with the same key may be added with this function. Use Set for setting a single header for the given key.
func (ResponseHeader) ByteSize ¶
func (h ResponseHeader) ByteSize() (size uint64)
func (ResponseHeader) Clone ¶
func (h ResponseHeader) Clone() types.HeaderMap
func (ResponseHeader) Del ¶
func (h ResponseHeader) Del(key string)
Del delete pair of specified key
func (ResponseHeader) Range ¶
func (h ResponseHeader) Range(f func(key, value string) bool)
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
func (ResponseHeader) Set ¶
func (h ResponseHeader) Set(key string, value string)
Set key-value pair in header map, the previous pair will be replaced if exists
Due to the fact that fasthttp's implementation doesn't have correct semantic for Set("key", "") and Peek("key") at the first time of usage. We need another way for compensate.
The problem is caused by the func initHeaderKV, if the original kv.value is nil, ant input value is also nil, then the final kv.value remains nil.
kv.value = append(kv.value[:0], value...)
fasthttp do has the kv entry, but kv.value is nil, so Peek("key") return nil. But we want "" instead.