File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
gateway/src/resty/http_ng/backend Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ backend.send = function(_, request)
3737 local httpc , err = http_proxy .new (request )
3838
3939 if err then
40- return nil , err
40+ return response . error ( request , err )
4141 end
4242
4343 if httpc then
Original file line number Diff line number Diff line change @@ -37,8 +37,11 @@ describe('resty backend', function()
3737 local req = { method = method , url = ' http://0.0.0.0:0/' }
3838 local response , err = backend :send (req )
3939
40- assert .falsy (response )
41- assert .equal (" connection refused" , err )
40+ assert .falsy (err )
41+ assert .truthy (response .error )
42+ assert .equal (" connection refused" , response .error )
43+ assert .falsy (response .ok )
44+ assert .same (req , response .request )
4245 end )
4346
4447 context (' http proxy is set' , function ()
Original file line number Diff line number Diff line change @@ -224,18 +224,18 @@ describe('http_ng', function()
224224 end )
225225
226226 describe (' when there is error #network' , function ()
227- local response , err
227+ local response
228228 before_each (function ()
229229 http = http_ng .new { backend = resty_backend }
230- response , err = http .get (' http://127.0.0.1:1' )
230+ response = http .get (' http://127.0.0.1:1' )
231231 end )
232232
233233 it (' is not ok' , function ()
234- assert .falsy ( response )
234+ assert .equal ( false , response . ok )
235235 end )
236236
237237 it (' has error' , function ()
238- assert .equal (" connection refused" , err )
238+ assert .equal (" connection refused" , response . error )
239239 end )
240240 end )
241241
You can’t perform that action at this time.
0 commit comments