Skip to contents

Create a scene_action specifying the HTTP method that must be used (or not used).

Usage

req_uses_method(method, negate = FALSE)

req_uses_get(negate = FALSE)

req_uses_post(negate = FALSE)

Arguments

method

The expected HTTP method.

negate

If TRUE, trigger the corresponding scene when this action is not matched.

Value

A scene_action, to be used in set_scene().

Examples

req_uses_method("GET")
#> $check_fn
#> <partialised>
#> function (...) 
#> ~.fn(method = ~method, ...)
#> <environment: 0x55fc8ce91a48>
#> 
#> $methods
#> [1] "GET"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"        
req_uses_method("POST")
#> $check_fn
#> <partialised>
#> function (...) 
#> ~.fn(method = ~method, ...)
#> <environment: 0x55fc8cd0b828>
#> 
#> $methods
#> [1] "POST"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"        
req_uses_get()
#> $check_fn
#> <partialised>
#> function (...) 
#> ~.fn(method = ~method, ...)
#> <environment: 0x55fc8cc398b8>
#> 
#> $methods
#> [1] "GET"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"        
req_uses_get(negate = TRUE)
#> $check_fn
#> function (...) 
#> !f(...)
#> <bytecode: 0x55fc8fbdbcc0>
#> <environment: 0x55fc8cac9070>
#> 
#> $methods
#> [1] "GET"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"        
req_uses_post()
#> $check_fn
#> <partialised>
#> function (...) 
#> ~.fn(method = ~method, ...)
#> <environment: 0x55fc8ca3a8a0>
#> 
#> $methods
#> [1] "POST"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"        
req_uses_post(negate = TRUE)
#> $check_fn
#> function (...) 
#> !f(...)
#> <bytecode: 0x55fc8fbdbcc0>
#> <environment: 0x55fc8c956f60>
#> 
#> $methods
#> [1] "POST"
#> 
#> attr(,"class")
#> [1] "scene_action" "list"