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

fix: remove path params when provided via API level options #147

Merged
merged 2 commits into from Jun 25, 2019

Conversation

JustinBeckwith
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 21, 2019
@JustinBeckwith JustinBeckwith requested a review from bcoe June 21, 2019 17:44
@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #147 into master will increase coverage by 0.48%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #147      +/-   ##
==========================================
+ Coverage   71.55%   72.03%   +0.48%     
==========================================
  Files           2        2              
  Lines         116      118       +2     
  Branches       35       36       +1     
==========================================
+ Hits           83       85       +2     
+ Misses         18       16       -2     
- Partials       15       17       +2
Impacted Files Coverage Δ
src/apirequest.ts 71.55% <50%> (+0.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90d807e...5288fc7. Read the comment docs.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

LGTM; I don't know googleapis common well enough to know if my recommendation is overboard, i.e., do we know parameters.context._options must be set?

Great argument for optional parameters!

@@ -160,6 +160,9 @@ async function createAPIRequestAsync<T>(parameters: APIRequestParams) {
// query
parameters.pathParams.forEach(param => {
delete params[param];
if (parameters.context._options.params) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth being defensive and checking:

if (parameters.context && parameters.context._options && parameters.context._options.params) {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants