MCPcopy
hub / github.com/kubernetes-client/python / select_header_accept

Method select_header_accept

kubernetes/client/api_client.py:508–522  ·  view source on GitHub ↗

Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json).

(self, accepts)

Source from the content-addressed store, hash-verified

506 return params
507
508 def select_header_accept(self, accepts):
509 """Returns `Accept` based on an array of accepts provided.
510
511 :param accepts: List of headers.
512 :return: Accept (e.g. application/json).
513 """
514 if not accepts:
515 return
516
517 accepts = [x.lower() for x in accepts]
518
519 if 'application/json' in accepts:
520 return 'application/json'
521 else:
522 return ', '.join(accepts)
523
524 def select_header_content_type(self, content_types, method=None, body=None):
525 """Returns `Content-Type` based on an array of content_types provided.

Calls

no outgoing calls

Tested by

no test coverage detected