Fix response code 301 processing

In _http_request() method if we got 301 status code after http request,
we try to get a new location in a wrong way - (`resp['location']`).
Now we use `getheader('location')` to new location from headers.

Added tests to _http_request() method (was mocked in existing tests).

Closes-Bug: #1246402

Change-Id: Ic69a27cd85299b0c1c60d9a2b9a870ad66152f6f