We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e4cb6f commit b02f3dcCopy full SHA for b02f3dc
lib/resty/http.lua
@@ -126,6 +126,9 @@ local DEFAULT_PARAMS = {
126
}
127
128
129
+local DEBUG = false
130
+
131
132
function _M.new(_)
133
local sock, err = ngx_socket_tcp()
134
if not sock then
@@ -135,6 +138,11 @@ function _M.new(_)
135
138
end
136
139
137
140
141
+function _M.debug(d)
142
+ DEBUG = (d == true)
143
+end
144
145
146
function _M.set_timeout(self, timeout)
147
local sock = self.sock
148
@@ -647,7 +655,7 @@ function _M.send_request(self, params)
647
655
648
656
-- Format and send request
649
657
local req = _format_request(params)
650
- ngx_log(ngx_DEBUG, "\n", req)
658
+ if DEBUG then ngx_log(ngx_DEBUG, "\n", req) end
651
659
local bytes, err = sock:send(req)
652
660
653
661
if not bytes then
0 commit comments