

def send_response(self, handle, connection, data, status=200):
    ' Send response header text/html\n        '
    header = (((((((('HTTP/1.0 ' + str(status)) + ' ') + calvinresponse.RESPONSE_CODES[status]) + '\n') + ('' if (data is None) else 'Content-Type: application/json\n')) + 'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS\n') + 'Access-Control-Allow-Origin: *\r\n') + '\n')
    if (connection is None):
        msg = {
            'cmd': 'httpresp',
            'msgid': handle,
            'header': header,
            'data': data,
        }
        self.tunnel_client.send(msg)
    else:
        if (not connection.connection_lost):
            connection.send(header)
            if data:
                connection.send(data)
            connection.close()
        del self.connections[handle]

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvincontrol.py CalvinControl.send_response/original