# 修改返回给调用端的响应体内容 local ctx = ngx.ctx local chunk, eof = ngx.arg[1], ngx.arg[2]
ctx.rt_body_chunks = ctx.rt_body_chunks or {} ctx.rt_body_chunk_number = ctx.rt_body_chunk_number or 1
if eof then local chunks = concat(ctx.rt_body_chunks) local body = responseBody ngx.arg[1] = body or chunks else ctx.rt_body_chunks[ctx.rt_body_chunk_number] = chunk ctx.rt_body_chunk_number = ctx.rt_body_chunk_number + 1 ngx.arg[1] = nil end