mirror of
https://github.com/alibaba/higress.git
synced 2026-02-06 23:21:08 +08:00
feat:add GetContextId func for HttpContext (#2043)
This commit is contained in:
@@ -73,6 +73,8 @@ type HttpContext interface {
|
||||
SetRequestBodyBufferLimit(byteSize uint32)
|
||||
// Note that this parameter affects the gateway's memory usage! Support setting a maximum buffer size for each response body individually in response phase.
|
||||
SetResponseBodyBufferLimit(byteSize uint32)
|
||||
// Get contextId of HttpContext
|
||||
GetContextId() uint32
|
||||
}
|
||||
|
||||
type oldParseConfigFunc[PluginConfig any] func(json gjson.Result, config *PluginConfig, log Log) error
|
||||
@@ -673,6 +675,10 @@ func (ctx *CommonHttpCtx[PluginConfig]) SetResponseBodyBufferLimit(size uint32)
|
||||
_ = proxywasm.SetProperty([]string{"set_encoder_buffer_limit"}, []byte(strconv.Itoa(int(size))))
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) GetContextId() uint32 {
|
||||
return ctx.contextID
|
||||
}
|
||||
|
||||
func (ctx *CommonHttpCtx[PluginConfig]) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
|
||||
requestID, _ := proxywasm.GetHttpRequestHeader("x-request-id")
|
||||
_ = proxywasm.SetProperty([]string{"x_request_id"}, []byte(requestID))
|
||||
|
||||
Reference in New Issue
Block a user