'Constructor.
Args:
request: reference to the request object (QNetworkRequest)
fileData: reference to the data buffer (QByteArray)
mimeType: for the reply (string)
parent: reference to the parent object (QObject)'

def __init__(self, request, fileData, mimeType, parent=None):

    super().__init__(parent)
    self._data = fileData
    self.setRequest(request)
    self.setUrl(request.url())
    self.setOpenMode(QIODevice.ReadOnly)
    self.setHeader(QNetworkRequest.ContentTypeHeader, mimeType)
    self.setHeader(QNetworkRequest.ContentLengthHeader, QByteArray.number(len(fileData)))
    self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200)
    self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, 'OK')
    QTimer.singleShot(0, (lambda : self.metaDataChanged.emit()))
    QTimer.singleShot(0, (lambda : self.readyRead.emit()))
    QTimer.singleShot(0, (lambda : self.finished.emit()))
