mirror of
https://github.com/alibaba/higress.git
synced 2026-03-04 00:20:50 +08:00
optimize retry&failover logic (#1903)
This commit is contained in:
@@ -44,6 +44,7 @@ type HttpContext interface {
|
||||
GetContext(key string) interface{}
|
||||
GetBoolContext(key string, defaultValue bool) bool
|
||||
GetStringContext(key, defaultValue string) string
|
||||
GetByteSliceContext(key string, defaultValue []byte) []byte
|
||||
GetUserAttribute(key string) interface{}
|
||||
SetUserAttribute(key string, value interface{})
|
||||
SetUserAttributeMap(kvmap map[string]interface{})
|
||||
@@ -483,6 +484,13 @@ func (ctx *CommonHttpCtx[PluginConfig]) GetStringContext(key, defaultValue strin
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) GetByteSliceContext(key string, defaultValue []byte) []byte {
|
||||
if s, ok := ctx.userContext[key].([]byte); ok {
|
||||
return s
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) Scheme() string {
|
||||
proxywasm.SetEffectiveContext(ctx.contextID)
|
||||
return GetRequestScheme()
|
||||
|
||||
Reference in New Issue
Block a user