diff --git a/examples/http_client/http_client.c b/examples/http_client/http_client.c
index 3f89d8ae6d4e384b870a562c64d785b8ea2a1d68..41eac581e90d8f3c8e619a8f2e4e038a11cb06f9 100644
--- a/examples/http_client/http_client.c
+++ b/examples/http_client/http_client.c
@@ -36,6 +36,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
     case MG_REPLY:
       // Send reply to the original connection
       orig = (struct mg_connection *) conn->connection_param;
+      mg_send_status(orig, conn->status_code);
       mg_send_header(orig, "Content-Type", "text/plain");
       mg_send_data(orig, conn->content, conn->content_len);
       mg_send_data(orig, "", 0);  // Last chunk: mark the end of reply
diff --git a/mongoose.c b/mongoose.c
index a7b1a34c9802484f3b97c6cc2002f56545480573..dae3c563ce33db7b768f4f1a14a86e5393ba25f7 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -2409,6 +2409,8 @@ static int parse_http_message(char *buf, int len, struct mg_connection *ri) {
   } else {
     if (is_request) {
       ri->http_version += 5;
+    } else {
+      ri->status_code = atoi(ri->uri);
     }
     parse_http_headers(&buf, ri);