Permalink
Browse files

added default body for error pages

  • Loading branch information...
1 parent 02b8903 commit 39a676f053339e81a795eabb51402fdd0f57d220 @paulbarbu committed May 10, 2014
Showing with 5 additions and 0 deletions.
  1. +5 −0 httpconnection.cpp
View
5 httpconnection.cpp
@@ -61,6 +61,11 @@ void HTTPConnection::write(uchar *data, int size)
void HTTPConnection::write(HTTPResponse response)
{
+ //TODO: for status codes that doesn't make sense, don't set the body
+ if("200" != response.getStatusCode() && response.getBody().isEmpty()){
+ response.setBody(response.getStatusCode() + " " + response.getReasonPhrase());
+ }
+
QByteArray partialResponse = response.getPartial();
qDebug() << Q_FUNC_INFO << "Writing" << partialResponse.size() << "bytes";

0 comments on commit 39a676f

Please sign in to comment.