Skip to content

Commit

Permalink
fix: middleware routing
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Oct 10, 2024
1 parent 26655cc commit c186f4c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ License: GPL (>= 3)
Encoding: UTF-8
LazyData: false
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Depends: R (>= 4.1.0)
Imports:
fs,
Expand Down
4 changes: 2 additions & 2 deletions R/routing.R
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,13 @@ Routing <- R6::R6Class(
middlewares,
private$.middleware |>
lapply(\(fn) {
attr(fn, "basepath") <- parent
attr(fn, "basepath") <- paste0(parent, private$.basepath)
return(fn)
})
)

if(!length(private$.routers)) return(middlewares)

parent <- paste0(parent, private$.basepath)

for(router in private$.routers) {
Expand Down Expand Up @@ -460,7 +461,6 @@ Routing <- R6::R6Class(
if(length(private$.middleware) > 0L){
for(i in seq_along(private$.middleware)) {
mid_basepath <- attr(private$.middleware[[i]], "basepath")
mid_basepath <- sprintf("^%s", mid_basepath)

mid_res <- NULL
if(grepl(mid_basepath, req$PATH_INFO))
Expand Down
2 changes: 2 additions & 0 deletions man/Ambiorix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/Request.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/Router.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions man/Routing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c186f4c

Please sign in to comment.