Describe the bug
When using the example for authentication the Swagger page is locked. Is this intentional, and is there a recommended way to enable docs without introducing state etc.?
To Reproduce
This is a simple API taken from plumber documentation
library(plumber)
#* @apiTitle Plumber Example API
#* @apiDescription Plumber example description.
#* @filter setuser
function(req) {
un <- req$cookies$user
# Make req$username available to endpoints
req$username <- un
plumber::forward()
}
#* @filter checkAuth
function(req, res) {
if (is.null(req$username)){
res$status <- 401 # Unauthorized
return(list(error="Authentication required"))
} else {
plumber::forward()
}
}
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg = "") {
list(msg = paste0("The message is: '", msg, "'"))
}
Expected behavior
Swagger docs are rendered
Screenshots
CLI (please complete the following information):
OS: Ubuntu
Version 22.04.3 LTS
Additional context
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsonlite_1.8.7 purrr_1.0.2 rlang_1.1.1 plumber_1.2.1 conflicted_1.2.0
loaded via a namespace (and not attached):
[1] later_1.3.1 R6_2.5.1 httpuv_1.6.11 fastmap_1.1.1 swagger_3.33.1 magrittr_2.0.3 webutils_1.2.0 cachem_1.0.8
[9] memoise_2.0.1 lifecycle_1.0.3 promises_1.2.1 cli_3.6.1 vctrs_0.6.5 rsconnect_1.1.0 compiler_4.3.1 rstudioapi_0.15.0
[17] tools_4.3.1 ellipsis_0.3.2 Rcpp_1.0.11 stringi_1.7.12
Describe the bug When using the example for authentication the Swagger page is locked. Is this intentional, and is there a recommended way to enable docs without introducing state etc.?
To Reproduce This is a simple API taken from plumber documentation
Expected behavior Swagger docs are rendered
Screenshots
CLI (please complete the following information):
Additional context