Created
March 3, 2020 02:39
-
-
Save willthames/ad5ab51bb2507cf96f52549bc6b6e84a to your computer and use it in GitHub Desktop.
This file contains 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
local tokenize = {} | |
function tokenize.tokenize(uri) | |
-- URLs that end in an ID | |
for _, path in ipairs({“/api/jobs, “/api/resources”}) do | |
if string.find(uri, path .. "/[^/]*") then | |
return string.gsub(uri, path .. "/.*", path .. "/{id}") | |
end | |
end | |
return uri | |
end | |
return tokenize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment