class_docstr: Wraps a Swagger operation into a Postman Request
class_docstr_tok: ["Wraps","a","Swagger","operation","into","a","Postman","Request"]
code: def headers(self):
      headers = {}
      # Handle content-type
      if self.method != "GET":
          consumes = self.collection.api.__schema__.get("consumes", [])
          consumes = self.operation.get("consumes", consumes)
          if len(consumes):
              headers["Content-Type"] = consumes[-1]
  
      # Add all parameters headers
      for param in self.operation.get("parameters", []):
          if param["in"] == "header":
              headers[param["name"]] = param.get("default", "")
  
      # Add security headers if needed (global then local)
      for security in self.collection.api.__schema__.get(
          "security", []
      ):
          for key, header in iteritems(self.collection.apikeys):
              if key in security:
                  headers[header] = ""
      for security in self.operation.get("security", []):
          for key, header in iteritems(self.collection.apikeys):
              if key in security:
                  headers[header] = ""
  
      lines = [":".join(line) for line in iteritems(headers)]
      return "\n".join(lines)
  
imports: from __future__ import unicode_literals, absolute_import
  from time import time
  from uuid import uuid5, NAMESPACE_URL
  from six import iteritems
  from six.moves.urllib.parse import urlencode
label_desc: Use image node_id 4 for calling the Request obj's underlying member method code with example usage: obj.headers() and returns: str