huskar_api/models/route/hijack.py
def hijack_response(self, tree_watcher):
        """Checks or hijacks the response iterator."""
        is_enabled = (
            self.hijack_mode in (self.Mode.enabled, self.Mode.standalone) and
            self.route_mode != ROUTE_MODE_ROUTE)
        is_enabled = is_enabled or len(self._force_enable_dest_apps) > 0
        for message, body in tree_watcher:
            if is_enabled and SERVICE_SUBDOMAIN in body:
                body = copy.deepcopy(body)
                type_body = body[SERVICE_SUBDOMAIN]
                for application_name, intent_map in self.hijack_map.items():
                    if application_name not in type_body:
                        continue
                    application_body = type_body[application_name]
                    for intent, cluster_names in intent_map.items():
                        if intent not in application_body:
                            continue
                        cluster_body = application_body[intent]
                        for cluster_name in cluster_names:
                            application_body[cluster_name] = cluster_body
            yield message, body
Checks or hijacks the response iterator.
Checks or hijacks the response iterator.
Checks or hijacks the response iterator .
def hijack_response(self, tree_watcher):
        is_enabled = (
            self.hijack_mode in (self.Mode.enabled, self.Mode.standalone) and
            self.route_mode != ROUTE_MODE_ROUTE)
        is_enabled = is_enabled or len(self._force_enable_dest_apps) > 0
        for message, body in tree_watcher:
            if is_enabled and SERVICE_SUBDOMAIN in body:
                body = copy.deepcopy(body)
                type_body = body[SERVICE_SUBDOMAIN]
                for application_name, intent_map in self.hijack_map.items():
                    if application_name not in type_body:
                        continue
                    application_body = type_body[application_name]
                    for intent, cluster_names in intent_map.items():
                        if intent not in application_body:
                            continue
                        cluster_body = application_body[intent]
                        for cluster_name in cluster_names:
                            application_body[cluster_name] = cluster_body
            yield message, body
def hijack_response ( self , tree_watcher ) : is_enabled = ( self . hijack_mode in ( self . Mode . enabled , self . Mode . standalone ) and self . route_mode != ROUTE_MODE_ROUTE ) is_enabled = is_enabled or len ( self . _force_enable_dest_apps ) > 0 for message , body in tree_watcher : if is_enabled and SERVICE_SUBDOMAIN in body : body = copy . deepcopy ( body ) type_body = body [ SERVICE_SUBDOMAIN ] for application_name , intent_map in self . hijack_map . items ( ) : if application_name not in type_body : continue application_body = type_body [ application_name ] for intent , cluster_names in intent_map . items ( ) : if intent not in application_body : continue cluster_body = application_body [ intent ] for cluster_name in cluster_names : application_body [ cluster_name ] = cluster_body yield message , body
Checks or hijacks the response iterator.
Checks or hijacks the response iterator .
"""Checks or hijacks the response iterator."""
self
tree_watcher