-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix (getAgent): add nullish check for uri #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greetings, and thanks for the PR! Can you share a little more on the motivations here? The getAgent
method requires this uri
parameter because we use it. What is the scenario where this would be null/undefined?
Hey @JustinBeckwith - thanks for the quick response. Not sure if you saw the original issue which talked about the motivation behind this change, but happy to explain again here. It looks like there is a type assertion on As a result, I noticed this happening in The only real fix needed is |
Got it - thanks for the details! The type assertion you linked to makes the assumption that one of |
Exactly! And I think that's what's happening in
Lol same. That makes sense to me. In that case, should I check if |
Yeah I think throwing with a reasonable error here makes sense. It should be backward compatible, because it was going to throw, just with a weird error anyways. I would throw right after we try to snag the uri here: Thanks for sticking with me here! |
5336f33
to
2b688ae
Compare
Makes sense. Thanks for the suggestion! I added two tests as well for this change. Let me know what you think!
Thanks for being kind, patient and helpful! |
🤖 I have created a release \*beep\* \*boop\* --- ### [7.1.1](https://www.github.com/googleapis/teeny-request/compare/v7.1.0...v7.1.1) (2021-06-30) ### Bug Fixes * throw error if missing uri or url ([#239](https://www.github.com/googleapis/teeny-request/issues/239)) ([4d770e3](https://www.github.com/googleapis/teeny-request/commit/4d770e3b89254c4cec30c422cdcdad257500c9cc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This adds a fix to
requestToFetchOptions
to throw an exception ifuri
is missing when calling fromteenyRequest
.We should do this because we can't guarantee that the value is always a string
(due to type assertions) or code calling it without a valid string.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #236 🦕