File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ local lrucache = require("resty.lrucache")
9
9
local server_name = require (" ngx.ssl" ).server_name
10
10
local tb_new = require (" table.new" )
11
11
local tb_clear = require (" table.clear" )
12
+ local isempty = require (" table.isempty" )
12
13
local utils = require (" kong.router.utils" )
13
14
local yield = require (" kong.tools.utils" ).yield
14
15
@@ -80,8 +81,13 @@ local function escape_str(str)
80
81
end
81
82
82
83
84
+ local function is_empty_field (f )
85
+ return f == nil or f == null or isempty (f )
86
+ end
87
+
88
+
83
89
local function gen_for_field (name , op , vals , val_transform )
84
- if not vals or vals == null then
90
+ if is_empty_field ( vals ) then
85
91
return nil
86
92
end
87
93
520
526
521
527
522
528
_M .escape_str = escape_str
529
+ _M .is_empty_field = is_empty_field
523
530
_M .gen_for_field = gen_for_field
524
531
_M .split_host_port = split_host_port
525
532
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ local tb_nkeys = require("table.nkeys")
9
9
10
10
11
11
local escape_str = atc .escape_str
12
+ local is_empty_field = atc .is_empty_field
12
13
local gen_for_field = atc .gen_for_field
13
14
local split_host_port = atc .split_host_port
14
15
@@ -76,7 +77,7 @@ local function get_expression(route)
76
77
tb_insert (out , gen )
77
78
end
78
79
79
- if hosts and hosts ~= null then
80
+ if not is_empty_field ( hosts ) then
80
81
tb_clear (exp_hosts_t )
81
82
local hosts_t = exp_hosts_t
82
83
@@ -133,7 +134,7 @@ local function get_expression(route)
133
134
tb_insert (out , gen )
134
135
end
135
136
136
- if headers and headers ~= null then
137
+ if not is_empty_field ( headers ) then
137
138
tb_clear (exp_headers_t )
138
139
local headers_t = exp_headers_t
139
140
You can’t perform that action at this time.
0 commit comments