示例#1
0
    def get_request_headers(self):
        """
        Overridden from Probe: construct request_headers
        via parameter substitution from content_type Parameter.
        """

        # content_type =
        # {'post_content_type': self._parameters['content_type']}
        # request_headers =
        #       self.REQUEST_HEADERS['content-type'].format(**content_type)
        # Hmm seems simpler
        headers = Probe.get_request_headers(self)
        return headers.update(
            {'Content-Type': self._parameters['content_type']})
示例#2
0
    def get_request_headers(self):
        headers = Probe.get_request_headers(self)

        # Clear possibly dangling ESRI header
        # https://github.com/geopython/GeoHealthCheck/issues/293
        if 'X-Esri-Authorization' in headers:
            del headers['X-Esri-Authorization']

        if 'Authorization' in headers:
            # https://enterprise.arcgis.com/en/server/latest/
            #     administer/linux/about-arcgis-tokens.htm
            auth_val = headers['Authorization']
            if 'Bearer' in auth_val:
                headers['X-Esri-Authorization'] = headers['Authorization']
        return headers