File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ local Usage = require('apicast.usage')
14
14
local errors = require (' apicast.errors' )
15
15
local Upstream = require (' apicast.upstream' )
16
16
local escape = require (" resty.http.uri_escape" )
17
+ local cjson = require (' cjson' )
17
18
18
19
local assert = assert
19
20
local type = type
@@ -175,7 +176,8 @@ function _M.get_upstream(service, context)
175
176
176
177
-- Due to API as a product, the api_backend is no longer needed because this
177
178
-- can be handled by routing policy
178
- if not service .api_backend then
179
+ local api_backend = service .api_backend
180
+ if not api_backend or api_backend == cjson .null or api_backend == ' ' then
179
181
return nil , nil
180
182
end
181
183
Original file line number Diff line number Diff line change 1
1
local http_ng_response = require (' resty.http_ng.response' )
2
2
local lrucache = require (' resty.lrucache' )
3
+ local cjson = require (' cjson' )
3
4
4
5
local configuration_store = require ' apicast.configuration_store'
5
6
local Service = require ' apicast.configuration.service'
@@ -64,6 +65,18 @@ describe('Proxy', function()
64
65
assert .falsy (err )
65
66
end )
66
67
68
+ it (" on no api_backend return empty string and no error" , function ()
69
+ local upstream , err = get_upstream ({api_backend = ' ' })
70
+ assert .falsy (upstream )
71
+ assert .falsy (err )
72
+ end )
73
+
74
+ it (" on no api_backend return null and no error" , function ()
75
+ local upstream , err = get_upstream ({api_backend = cjson .null })
76
+ assert .falsy (upstream )
77
+ assert .falsy (err )
78
+ end )
79
+
67
80
end )
68
81
69
82
describe (' .authorize' , function ()
You can’t perform that action at this time.
0 commit comments