Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plumber::forward() is a nightmare to handle #980

Open
schloerke opened this issue Jan 27, 2025 · 1 comment
Open

plumber::forward() is a nightmare to handle #980

schloerke opened this issue Jan 27, 2025 · 1 comment
Labels
theme: middleware Only execute endpoint specific code type: enhancement Adds a new, backwards-compatible feature

Comments

@schloerke
Copy link
Collaborator

Related: #907 (comment)

The code in Meztez's comment is something that I'd like to require... that forward() (or which ever method we use) be returned from the filter.

library(plumber)
library(future)
plan("multisession")

#* @filter future
function(req) {
  print(req$PATH_INFO)
  if (req$PATH_INFO=="/echo1") {
    future::future({
      Sys.sleep(10)
      plumber::forward()
    })
  } else {
    plumber::forward()
  }
}

#* @serializer text
#* @get /echo1
function(msg) {
  msg
}

#* @serializer text
#* @get /echo2
function(msg) {
  msg
}
  • I believe this should be done if/when we add middlware.
  • I believe it should have a new function name as it has different functionality than plumber::forward().
@schloerke schloerke added theme: middleware Only execute endpoint specific code type: enhancement Adds a new, backwards-compatible feature labels Jan 27, 2025
@thomasp85
Copy link
Collaborator

In fiery/routr I simply used TRUE/FALSE return values to indicate whether further handling should be performed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: middleware Only execute endpoint specific code type: enhancement Adds a new, backwards-compatible feature
Projects
None yet
Development

No branches or pull requests

2 participants