Read body of response before closing connection.
Reorganize code