It has been some time since I had to debug my queries and everything could be changed in Qt, but I needed to access different parts of the queries using various functions to get all the details.
I created a wrapper for the post function, which will print the details before sending the request. Here's a snippet of code that retrieves and prints URLs, source headers, and data, for example:
void debugRequest(QNetworkRequest request, QByteArray data = QByteArray()) { ... qDebug() << request.url().toString(); const QList<QByteArray>& rawHeaderList(request.rawHeaderList()); foreach (QByteArray rawHeader, rawHeaderList) { qDebug() << request.rawHeader(rawHeader); } qDebug() << data; ... }
source share