GiftLee edited a comment on issue #2827:
URL: https://github.com/apache/apisix/issues/2827#issuecomment-738504369


   i think enhance fault-injection ,add function 
   
   like  this 
   ```
   
   function _M.rewrite(conf, ctx)
       core.log.info("plugin rewrite phase, conf: ", 
core.json.delay_encode(conf))
   
       if conf.delay
          and conf.delay.duration ~= nil
          and sample_hit(conf.delay.percentage)
       then
           sleep(conf.delay.duration)
       end
   
       if conf.abort
          and conf.abort.http_status ~= nil
          and sample_hit(conf.abort.percentage)
       then
          
           local body = string.gsub(conf.abort.body, "%$(.-)%$", function 
(func)  return loadstring(func)() end)
          
           return conf.abort.http_status, body
       end
   end
   ```
   is good idea ?
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to