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

Fixes to FileService and OAuthTokenService #1509

Merged
merged 1 commit into from
Feb 10, 2019

Conversation

ob-stripe
Copy link
Contributor

r? @remi-stripe

In #1504, I inadvertently removed the part of the code that sends file creation requests to files.stripe.com rather than api.stripe.com 😱 Tests were still passing because in the test suite, we replace both hostnames with localhost since stripe-mock handles both.

It should be easier to test this once I'm done refactoring the requestor code.

The changes to OAuthTokenService isn't a fix, it's just to make the code a bit cleaner by using standard creation methods.

@ob-stripe ob-stripe mentioned this pull request Feb 10, 2019
52 tasks
@@ -26,11 +23,15 @@ public FileService(string apiKey)

public virtual File Create(FileCreateOptions options, RequestOptions requestOptions = null)
{
requestOptions = this.SetupRequestOptions(requestOptions);
requestOptions.BaseUrl = requestOptions.BaseUrl ?? StripeConfiguration.FilesBase;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully grasp that line and why it's needed. Since we always know we want FilesBase here why change it? Is it just for tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean why it's

requestOptions.BaseUrl = requestOptions.BaseUrl ?? StripeConfiguration.FilesBase;

instead of just

requestOptions.BaseUrl = StripeConfiguration.FilesBase;

? If so, it's just because I think it's bad practice to silently overwrite an existing value. In practice, this doesn't change anything: BaseUrl is internal, so it cannot be set by library users, and there is no internal code that calls FileService.Create / CreateAsync.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that's mostly what I meant. The dichotomy between what you know you want and what the other property could be! But all good!

@remi-stripe remi-stripe assigned ob-stripe and unassigned remi-stripe Feb 10, 2019
@ob-stripe ob-stripe merged commit 87a69b5 into integration-v23 Feb 10, 2019
@ob-stripe ob-stripe deleted the ob-service-fixes branch February 10, 2019 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants