Handle client_id/client_secret nil case. #85
Merged
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.
The commit (e351f4d) that introduced UAA url escape encoding compatibility means client_id and client_secret can no longer be nil or an error is thrown.
I am honestly not 100% sure if the nil case should be valid (we have a series of -- I think -- integration tests that are using nil here, so perhaps it is?). In any case, the nil case was previously supported. If the nil case is invalid, maybe this class should throw ArgumentError on instantiation instead?
I made this change targeted within the #request_token method because I'm not sure what the possible implications would be by defaulting it in the initialize, but that might arguably be a better place for it if it does not cause a behavior change.
One other minor note: when reading the code I found the option name
basic_auth
a little confusing, since both requests are using basic_auth. After reading about the reason for the switch, I wonder if something like "unescaped_basic_auth" (or something similar) might be a better name? If you agree, happy to also create a PR that provides both the old 'basic_auth' (for backwards compatibility) and new option.