-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: Add x-goog-api-client
header to rest clients
#888
Conversation
Also add `Content-Type: application/json` header
Codecov Report
@@ Coverage Diff @@
## master #888 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 27 +1
Lines 1608 1697 +89
Branches 328 347 +19
=========================================
+ Hits 1608 1697 +89
Continue to review full report at Codecov.
|
@@ -207,8 +207,11 @@ class {{ service.name }}RestTransport({{ service.name }}Transport): | |||
url += '?{}'.format('&'.join(query_params)).replace(' ', '+') | |||
|
|||
# Send the request | |||
headers = dict(metadata) | |||
headers['Content-Type'] = 'application/json' |
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.
Naive question: this is not x-goog-api-client
. Where does the name content-type
come from? Is there documentation somewhere describing it?
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.
The Content-Type
header is a part of HTTP standard: https://datatracker.ietf.org/doc/html/rfc2616#section-14.17
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.
@software-dov See also the internal REGAPIC gRPC transcoding design doc, where we call this out explicitly (relatively recent addition, since we found some RPCs fail without it)
gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2
Outdated
Show resolved
Hide resolved
@busunkim96 PTAL |
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.
LGTM.
I suspect the coverage drop is from the clauses I added to keep compatibility with older google-auth and google-api-core versions in 89d6f35#diff-f7a16a65f061822bcc73b8296f4dc837353d379d8d9cc5307982cb6941442835.
Opened PR to remove code / tests for google-api-core < 1.26.0. See #893 Once that is merged updating this branch should resolve the coverage issues. |
@vam-google CI is now passing. |
Also add
Content-Type: application/json
header.This PR depends on googleapis/python-api-core#189, and assumes that google-api-core version 1.27.0 has been already released (which was not the case on the moment of creation of this PR).