-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
api_core: Add routing header #4336
Conversation
|
||
"""Helpers for handling routing header params.""" | ||
|
||
METADATA_KEY = 'x-goog-header-params' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
def to_routing_header(params): | ||
"""Returns the routing header string that the params form""" | ||
return "&".join(["{}={}".format(*pair) for pair in params]) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
params = [('name', 'meep'), ('book.read', True)] | ||
metadata = routing_header.to_grpc_metadata(params) | ||
assert metadata == ( | ||
routing_header.METADATA_KEY, "name=meep&book.read=True") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
"""Helpers for handling routing header params.""" | ||
|
||
|
||
try: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ROUTING_METADATA_KEY = 'x-goog-header-params' | ||
|
||
|
||
def _to_url_string(x): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
def to_routing_header(params): | ||
"""Returns the routing header string that the params form""" | ||
return urlencode(params) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Example: