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

Fixed config override with GetBackendWithConfig #1895

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

Zyko0
Copy link
Contributor

@Zyko0 Zyko0 commented Jul 24, 2024

Fixes #1894

Let me know if you see another way to write the test, or if you prefer another way to handle the config => cfg thing!

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@helenye-stripe helenye-stripe self-assigned this Jul 24, 2024
@helenye-stripe
Copy link
Contributor

helenye-stripe commented Jul 24, 2024

Hi @Zyko0. Thanks so much for submitting this fix! Would it be possible to add a test to verify that using UploadBankend will correctly access the uploads API URL? It would be good to see this in use with a mock call to the API. Maybe something similar to https://github.com/stripe/stripe-go/blob/master/file/client_test.go#L66-L69.

@Zyko0
Copy link
Contributor Author

Zyko0 commented Jul 25, 2024

Hey @helenye-stripe, I'm not sure to understand how to make it similar to the code you linked.
It seems testBackend does not do anything and prevents any URL testing.

As for the test, I just made something locally, but if I'm using NewBackendsWithConfig I have to hard-define the URL to the stripe-mock one, or to the originally set UploadBackend which kinda defeats the purpose.

Since this fix is meant to address the case when no URL is supplied 😬

Not setting the URL in the backend config, makes it set by the stripe sdk to https://files.stripe.com which doesn't work locally (but at least this shows that the upload backend URL is correctly set even if it's set after the API backend with an empty URL in the config)

@helenye-stripe helenye-stripe merged commit cc5e657 into stripe:master Jul 30, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetBackendWithConfig overrides the config argument
3 participants