Description Usage Arguments See Also Examples
Get a request's uri.
1 | uri(x)
|
x |
A request object. |
Other HTTP request request-line: method
,
query
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | mkup_name <- mockup(
route(
'GET',
'^/wizard/[a-z]+$',
function(req) {
res <- response()
# An alternative to passing information
# as a request query
wizard_name <- gsub('^/wizard/', '', uri(req))
picker <- list(
title = c('The', 'Dark Lord', 'Sir'),
name = wizard_name,
of = 'of the',
adjective = c('Enduring', 'Swift', 'Red', 'Great'),
noun = c('Heavens', 'Coldness', 'Winglelings', 'Stars')
)
body(res) <- paste(
lapply(picker, function(n) n[sample(length(n), 1)]),
collapse = ' '
)
res
}
)
)
res <- mkup_name('GET', '/wizard/jenkins')
body(res)
res <- mkup_name('GET', '/wizard/merlin')
body(res)
res <- mkup_name('GET', '/wizard/sparrowhawk')
body(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.