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: http2: serialize array parameters correctly #492

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

harris-m
Copy link
Contributor

@harris-m harris-m commented Nov 9, 2022

Partially fixes #480 (the "wrong queryParameters serialization" part)

I noticed that a parameter with type string[] in the Google Calendar API was not working as expecting while using google.options({ http2: true });. Specifically I was trying to use:

google.options({ http2: true });
google
  .calendar({
    version: "v3",
    auth: new google.auth.OAuth2(...),
  })
  .events.list({
    calendarId: ...,
    privateExtendedProperty: [`foo=bar`, `baz=asdf`],
  });

I found that the privateExtendedProperty parameter was being ignored by the server.

I traced the issue to this line. Unlike the gaxios request handler (reference), the http2 handler is not calling the paramsSerializer from the parameters. This function is used to define the correct serialization method for array parameters in apirequest.ts (reference).

My fix uses the paramsSerializer passed in from the parameters exactly as is done in gaxios.

@harris-m harris-m requested a review from a team as a code owner November 9, 2022 02:28
@google-cla
Copy link

google-cla bot commented Nov 9, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Nov 9, 2022
@danielbankhead danielbankhead added kokoro:run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Nov 29, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 29, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 29, 2022
@bcoe bcoe merged commit f4c36b8 into googleapis:main Dec 1, 2022
@bcoe
Copy link
Contributor

bcoe commented Dec 1, 2022

@harris-m thank you for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http2 POST requests deadlock, wrong queryParameters serialization
4 participants