AlinsRan opened a new pull request, #13771:
URL: https://github.com/apache/apisix/pull/13771

   ### Description
   
   `resp_exit` is variadic — it accepts a non-numeric first argument (no status 
code), and any number of body parts which are printed in order, with tables 
encoded as JSON:
   
   ```lua
   local function resp_exit(code, ...)
       ...
       if code and type(code) ~= "number" then
           idx = idx + 1
           t[idx] = code
           code = nil
       end
   ```
   
   `t/core/response.t` only ever calls `exit(code, body)`, so none of that is 
covered, and `_M.say` is not exercised at all. 
`apisix/plugins/mcp/server_wrapper.lua` already depends on the variadic form:
   
   ```lua
   return core.response.exit(message_handler(conf, ctx, opts))
   ```
   
   ### Changes
   
   Three tests, no production code touched:
   
   - TEST 9 — `exit("done\n")`: no status code, body still written, response 
stays 200
   - TEST 10 — `exit(201, "a", {b = "b"}, "c\n")`: parts printed in order, the 
table encoded as JSON
   - TEST 11 — `say("a", "b", "c\n")`
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation accordingly
   - [x] I have verified that the change is backward compatible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to