-
Notifications
You must be signed in to change notification settings - Fork 4
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
Pass URL encoded string as parameter in path #106
Comments
It seems like the web server decodes the path in the URL automatically. IDK if this is what web servers are supposed to do, the GitLab web server is not doing it apparently. This might be ok for the fake api, or might not. E.g. for
it is OK, because you can take the rest or the path as
it it not OK, because you won't know if Unfortunately the web server we are using in internally does not give us access to the raw URL, AFAICT. For a fake app you can work around this by checking if the suffix of the path is something that would indicate another API endpoint. (And not using a path that ends with This is how to match the rest of the path with a regex, btw: app$get(
webfakes::new_regexp("^/hello/(?<path>.*)$"),
function(req, res) {
res$send(paste0("Return content of ", req$params$path, "!"))
}
) |
Actually, it seems like the web server has an option for this, which we could expose. I'll submit a PR in a minute. |
PR here: #107 |
Looks great! 🎉 |
I want to test an endpoint that accepts URL-encoded file paths ("/hello/:file_path"). However, the
app$get()
method throws a 404-error.I'm also sharing a real-world example from the GitLab API, where the
file_path
parameter is URL encoded.Created on 2025-01-09 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: