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

Actually use apiPath when mounting the docs #977

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thomasp85
Copy link
Collaborator

Fix #836

The apiPath option was never used during the actual mounting of the docs router - only for reporting the url of it.

This is now fixed.

@schloerke can you please advise me where tests for this bug (and the fix) are best placed?

@schloerke schloerke added this to the v1.3.0 milestone Jan 29, 2025
@@ -264,7 +263,7 @@ Plumber <- R6Class(
callback = swaggerCallback,
quiet = quiet
)
on.exit(unmount_docs(self, docs_info), add = TRUE)
#on.exit(unmount_docs(self, docs_info), add = TRUE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this still needs to be there as the docs will want to be mounted again on a followup run.

@schloerke
Copy link
Collaborator

Instead of altering just the docs, should we adjust how pr$handle() and pr$mount() will prepend the path portion of

plumber/R/ui.R

Lines 12 to 22 in 5980d1e

# Build api url
api_url <- get_option_or_env(
"plumber.apiURL",
urlHost(
scheme = get_option_or_env("plumber.apiScheme", "http"),
host = get_option_or_env("plumber.apiHost", host),
port = get_option_or_env("plumber.apiPort", port),
path = get_option_or_env("plumber.apiPath", ""),
changeHostLocation = TRUE
)
)

If we do not apply it internally to the two methods, we should still use the path portion of the api_url when mounting the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

global basepath
2 participants