Solved How to know if QNetworkReply has a body?
I'm wondering, how to know if
QNetworkReplyhas a body? I tried find and I couldn't find any method like
->hasBodyor something like that.
Hi and welcome to devnet,
There's nothing like that. You have to parse the content of the reply that you received.
@SGaist With parse you mean, put the
QStringand check if it is empty?
Yes, but checking for empty depends on what request you did. You can have a valid empty answer i.e. status code 200 for an operation that doesn't answer anything particular.
@SGaist Yes, I know, I'm making a few tests with a local server and that is exactly the idea, to check if the body is empty, not the status code or anything else, only if the body is empty.
I thought that Qt would have a method or something like
hasBody, but I can live with that.
You're welcome !
Since the point has been clarified, please mark the thread as solved using the "Topic Tool" button so other forum users may know a solution has been found :)