Skip to content

Commit 184678c

Browse files
authored
chore: add ngx.flush after ngx.print (#1194) (#12988)
Signed-off-by: Nic <[email protected]>
1 parent 7f56ffc commit 184678c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

apisix/plugin.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ local re_split = require("ngx.re").split
2525
local ngx = ngx
2626
local ngx_ok = ngx.OK
2727
local ngx_print = ngx.print
28+
local ngx_flush = ngx.flush
2829
local crc32 = ngx.crc32_short
2930
local ngx_exit = ngx.exit
3031
local pkg_loaded = package.loaded
@@ -1349,6 +1350,7 @@ function _M.lua_response_filter(api_ctx, headers, body)
13491350
if not plugins or #plugins == 0 then
13501351
-- if there is no any plugin, just print the original body to downstream
13511352
ngx_print(body)
1353+
ngx_flush()
13521354
return
13531355
end
13541356
for i = 1, #plugins, 2 do
@@ -1377,6 +1379,7 @@ function _M.lua_response_filter(api_ctx, headers, body)
13771379
::CONTINUE::
13781380
end
13791381
ngx_print(body)
1382+
ngx_flush()
13801383
end
13811384

13821385

0 commit comments

Comments
 (0)