Support @aspace_backend_url with a path and ensure URI join respects it #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So.. this might be a bit brute force, but it works!
The first thing we do is now check if
aspace_backend_url
has a path and store this inaspace_backend_path
. Also, we ensure there's a trailing/
on the path.So now we have something like:
Now in
get
andpost_json
, we join the incomingpath
with the aspace_backend_url and aspace_backend_path. We remove any leading/
from thepath
so it's treated as a relative path:For example when logging in, this would join 'https://mydomain/my/path' with '/my/path/' and 'users/login'. This results in
https://mydomain/my/path/users/login
.When there's no aspace_backend_path (or when it's '/'), this simply becomes the root path and
users/login
is appended.