Description Usage Arguments See Also Examples
Get information about a request such as method type, the requested resource uri, the query component, or the requset HTTP protocol.
1 | method(x)
|
x |
A request object. |
Other HTTP request request-line: query
,
uri
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 | methodical <- route(
c('GET', 'POST'),
'^',
function(req) {
res <- response()
if (method(req) == 'GET') {
# handle when method is GET
body(res) <- 'I got ya'
} else {
body(res) <- 'Washingtong or Huffington?'
}
res
}
)
methodical_m <- mockup(methodical)
res <- methodical_m('GET', '/')
res
res <- methodical_m('POST', '/')
body(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.