Last active
July 17, 2019 01:59
-
-
Save membphis/a63aa0e5771f118e0cfb848e2214acb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== TEST 1: set route(id: 1) | |
--- config | |
location /t { | |
content_by_lua_block { | |
local t = require("lib.test_admin").test | |
local code, body = t('/apisix/admin/routes/1', | |
ngx.HTTP_PUT, | |
[[{ | |
"methods": ["GET"], | |
"upstream": { | |
"nodes": { | |
"127.0.0.1:1980": 1 | |
}, | |
"type": "roundrobin" | |
}, | |
"host": "foo.com", | |
"uri": "/h{:.*}" | |
}]] | |
) | |
if code >= 300 then | |
ngx.status = code | |
end | |
ngx.say(body) | |
} | |
} | |
--- request | |
GET /t | |
--- response_body | |
passed | |
--- no_error_log | |
[error] | |
=== TEST 2: hit routes | |
--- request | |
GET /hello | |
--- more_headers | |
Host: foo.com | |
--- response_body | |
hello world | |
--- no_error_log | |
[error] | |
=== TEST 3: not found | |
--- request | |
GET /world | |
--- more_headers | |
Host: foo.com | |
--- error_code: 404 | |
--- no_error_log | |
[error] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment