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

Never require 'body' for requests. #718

Merged
merged 1 commit into from
Jul 17, 2019

Conversation

busunkim96
Copy link
Contributor

Fixes #713.

Never require that a body be passed in a request. Validation of body will be left to the server.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 16, 2019
@busunkim96
Copy link
Contributor Author

If you forget to pass a body to an API that has required properties, the server will throw an error.

Example:

(create requires a body with a new job as its payload.)

from googleapiclient.discovery import build

service = build('jobs', 'v2')
req = service.jobs().create()
resp = req.execute()
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://jobs.googleapis.com/v2/jobs?alt=json returned "Following fields are missing or invalid: Company Name, Description, Title, Job Requisition ID, One of Application Method (URL/Emails/Instructions). (Possible reasons: non-numeric for double field, invalid language code, etc.). Request ID for tracking:

@busunkim96 busunkim96 requested a review from a team July 16, 2019 23:31
@busunkim96 busunkim96 merged commit b854ff1 into googleapis:master Jul 17, 2019
@TxBillbr
Copy link

How long will it take before this is visible to the client lib? Passing body={} in a request is very dangerous Python behavior. This broke a bunch of our automation.

@busunkim96
Copy link
Contributor Author

@TxBillbr I'll cut a release today -- apologies for the disruption this caused!

@TxBillbr
Copy link

TxBillbr commented Jul 23, 2019

Thanks much for the prompt handling. I have just released a local work-around for our local library that tries the correct method and if it throws an error tries with the body={}.

@busunkim96
Copy link
Contributor Author

@TxBillbr This is available in the latest release 1.7.10

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.

cloudresourcemanager.project.getIamPolicy recently started throwing 'Missing required parameter "body"'
4 participants