mirror of
https://github.com/alibaba/higress.git
synced 2026-03-17 00:40:48 +08:00
optimize retry&failover logic (#1903)
This commit is contained in:
@@ -136,7 +136,7 @@ func HttpCall(cluster Cluster, method, rawURL string, headers [][2]string, body
|
||||
requestID, code, normalResponse, respBody)
|
||||
callback(code, headers, respBody)
|
||||
})
|
||||
proxywasm.LogDebugf("http call start, id: %s, cluster: %s, method: %s, url: %s, body: %s, timeout: %d",
|
||||
requestID, cluster.ClusterName(), method, rawURL, body, timeout)
|
||||
proxywasm.LogDebugf("http call start, id: %s, cluster: %s, method: %s, url: %s, headers: %#v, body: %s, timeout: %d",
|
||||
requestID, cluster.ClusterName(), method, rawURL, headers, body, timeout)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -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