def validate_header()

in callouts/python/extproc/example/set_cookie/service_callout_example.py [0:0]


def validate_header(http_headers: service_pb2.HttpHeaders) -> Union[str, None]:
  """Validate if the incomming headers contain the 'cookie-check' header.

  This function checks if the 'cookie-check' header is present in the
  headers and returns its raw value if found.

  Args:
      http_headers (service_pb2.HttpHeaders): Incomming http headers to check.

  Returns:
      str or None: The raw value of the 'cookie-check' header if found, otherwise None.
  """
  return next((header.raw_value
                   for header in http_headers.headers.headers
                   if header.key == 'cookie-check'), None)