Add tests for fetch_url
Various fixes/cleanup for http usage