Make sure the base url is set when calling authenticate_request #27
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.
This is a fix for the issue where the base url was not being set when calling authenticate_request.It caused an error later in the
microsoft_kiota_authentication_oauth
gem. The crux of the problem goes like that:request_info
is passed to theaccess_token_provider
andrequest_info.uri
is used to build the request here. Thisuri
is missing the base url.scheme
is nothttps
. Because the base url is missing, the URI is only parsed as a relative path and thus always fails the scheme check.The fix is to always make sure we set the
baseurl
before calling action where the url might be templated. The fix is inspired from the Csharp version of the class.I tried adding some kind of test, but there almost nothing already in place and to test my small fix, I would have to either mock or instantiate a dozen of classes which some are not even in the same gem 😢.