@@ -11,7 +11,7 @@ __DATA__
1111--- config
1212 location /t {
1313 content_by_lua_block {
14- local json = require("cjson.safe ")
14+ local json = require("ljson ")
1515 local radix = require("resty.radixtree")
1616 local rx = radix.new({
1717 {
@@ -36,17 +36,17 @@ GET /t
3636[error]
3737--- response_body
3838match meta: metadata /name
39- matched: {"_path":"\ /name\ /*name","name":"json"}
39+ matched: {"_path":"/name/*name","name":"json"}
4040match meta: metadata /name
41- matched: {"_path":"\ /name\ /*name","name":""}
41+ matched: {"_path":"/name/*name","name":""}
4242
4343
4444
4545=== TEST 2: /name/* in path
4646--- config
4747 location /t {
4848 content_by_lua_block {
49- local json = require("cjson.safe ")
49+ local json = require("ljson ")
5050 local radix = require("resty.radixtree")
5151 local rx = radix.new({
5252 {
@@ -71,17 +71,17 @@ GET /t
7171[error]
7272--- response_body
7373match meta: metadata /name
74- matched: {"_path ":"\/name\/* ",":ext ":"json\/foo\/bar "}
74+ matched: {":ext ":"json/foo/bar ","_path ":"/name/* "}
7575match meta: metadata /name
76- matched: {"_path ":"\/name\/* ",":ext ":""}
76+ matched: {":ext ":"","_path ":"/name/* "}
7777
7878
7979
8080=== TEST 3: /name/:name/id/:id
8181--- config
8282 location /t {
8383 content_by_lua_block {
84- local json = require("cjson.safe ")
84+ local json = require("ljson ")
8585 local radix = require("resty.radixtree")
8686 local rx = radix.new({
8787 {
@@ -107,17 +107,17 @@ GET /t
107107[error]
108108--- response_body
109109match meta: metadata /name
110- matched: {"name":"json"," _path":"\ /name\ /:name\ /id\ /:id","id":"1"}
110+ matched: {"_path":"/name/:name/id/:id","id":"1","name":"json "}
111111match meta: nil
112- matched: {}
112+ matched: []
113113
114114
115115
116116=== TEST 4: /name/:name/id/:id/*other
117117--- config
118118 location /t {
119119 content_by_lua_block {
120- local json = require("cjson.safe ")
120+ local json = require("ljson ")
121121 local radix = require("resty.radixtree")
122122 local rx = radix.new({
123123 {
@@ -138,15 +138,15 @@ GET /t
138138[error]
139139--- response_body
140140match meta: metadata /name
141- matched: {"other":"foo\/bar\/gloo","name":"json"," _path":"\ /name\ /:name\ /id\ /:id\ /*other","id":"1"}
141+ matched: {"_path":"/name/:name/id/:id/*other","id":"1","name":"json","other":"foo/bar/gloo "}
142142
143143
144144
145145=== TEST 5: /name/:name/id/:id (not match)
146146--- config
147147 location /t {
148148 content_by_lua_block {
149- local json = require("cjson.safe ")
149+ local json = require("ljson ")
150150 local radix = require("resty.radixtree")
151151 local rx = radix.new({
152152 {
@@ -167,15 +167,15 @@ GET /t
167167[error]
168168--- response_body
169169match meta: nil
170- matched: {}
170+ matched: []
171171
172172
173173
174174=== TEST 6: /name/:name/foo (cached parameter)
175175--- config
176176 location /t {
177177 content_by_lua_block {
178- local json = require("cjson.safe ")
178+ local json = require("ljson ")
179179 local radix = require("resty.radixtree")
180180 local rx = radix.new({
181181 {
@@ -200,17 +200,17 @@ GET /t
200200[error]
201201--- response_body
202202match meta: metadata /name
203- matched: {"_path":"\ /name\ /:name\ /foo","name":"json"}
203+ matched: {"_path":"/name/:name/foo","name":"json"}
204204match meta: nil
205- matched: {}
205+ matched: []
206206
207207
208208
209209=== TEST 7: /name/:name/foo (no cached parameter)
210210--- config
211211 location /t {
212212 content_by_lua_block {
213- local json = require("cjson.safe ")
213+ local json = require("ljson ")
214214 local radix = require("resty.radixtree")
215215 local rx = radix.new({
216216 {
@@ -242,7 +242,7 @@ pcre pat:
242242--- config
243243 location /t {
244244 content_by_lua_block {
245- local json = require("cjson.safe ")
245+ local json = require("ljson ")
246246 local radix = require("resty.radixtree")
247247 local rx = radix.new({
248248 {
0 commit comments