Ejemplo n.º 1
0
    def websocket_message(self, message_state):
        http_flow = HttpFlow.where('uuid', '=',
                                   message_state['flow_uuid']).first()

        websocket_message = WebsocketMessage.from_state(message_state)
        websocket_message.http_flow_id = http_flow.id
        websocket_message.save()

        cast(QtCore.SignalInstance,
             self.signals.websocket_message_created).emit(websocket_message)

        if message_state['intercepted']:
            http_flow.intercept_websocket_message = True
            cast(QtCore.SignalInstance,
                 self.signals.flow_intercepted).emit(http_flow)
Ejemplo n.º 2
0
    def response(self, response_state):
        http_response = HttpResponse.from_state(response_state)
        http_response.save()

        http_flow = HttpFlow.where('uuid', '=',
                                   response_state['flow_uuid']).first()
        if http_flow is None:
            return

        http_flow.response_id = http_response.id
        http_flow.save()

        cast(QtCore.SignalInstance, self.signals.flow_updated).emit(http_flow)

        if response_state['intercepted']:
            cast(QtCore.SignalInstance,
                 self.signals.flow_intercepted).emit(http_flow)
Ejemplo n.º 3
0
    def test_save(self, database, cleanup_database):
        item = factory(EditorItem, 'request').make(item_id=None)
        item.save()

        flow = HttpFlow.where('id', '=', item.id).first()
        assert flow is not None
Ejemplo n.º 4
0
 def item(self):
     if self.item_type == self.TYPE_HTTP_FLOW:
         return HttpFlow.where('id', '=', self.item_id).first()