Skip to content

Commit d29b8d7

Browse files
authored
fix ai proxy checkStream (#1645)
1 parent 2501895 commit d29b8d7

File tree

1 file changed

+3
-3
lines changed
  • plugins/wasm-go/extensions/ai-proxy

1 file changed

+3
-3
lines changed

plugins/wasm-go/extensions/ai-proxy/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func onHttpResponseHeaders(ctx wrapper.HttpContext, pluginConfig config.PluginCo
199199
}
200200
util.ReplaceResponseHeaders(headers)
201201

202-
checkStream(&ctx, log)
202+
checkStream(ctx, log)
203203
_, needHandleStreamingBody := activeProvider.(provider.StreamingResponseBodyHandler)
204204
if !needHandleStreamingBody {
205205
ctx.BufferResponseBody()
@@ -254,13 +254,13 @@ func onHttpResponseBody(ctx wrapper.HttpContext, pluginConfig config.PluginConfi
254254
return types.ActionContinue
255255
}
256256

257-
func checkStream(ctx *wrapper.HttpContext, log wrapper.Log) {
257+
func checkStream(ctx wrapper.HttpContext, log wrapper.Log) {
258258
contentType, err := proxywasm.GetHttpResponseHeader("Content-Type")
259259
if err != nil || !strings.HasPrefix(contentType, "text/event-stream") {
260260
if err != nil {
261261
log.Errorf("unable to load content-type header from response: %v", err)
262262
}
263-
(*ctx).BufferResponseBody()
263+
ctx.BufferResponseBody()
264264
ctx.SetResponseBodyBufferLimit(defaultMaxBodyBytes)
265265
}
266266
}

0 commit comments

Comments
 (0)