public void DetectDownloadContent() { HttpClientDownloader downloader = new HttpClientDownloader(); var a = downloader.Download(new Request("http://www.163.com", null)); Assert.Equal(ContentType.Html, a.ContentType); HttpClientDownloader2 downloader2 = new HttpClientDownloader2(); a = downloader2.Download(new Request("http://www.163.com", null)); Assert.Equal(ContentType.Json, a.ContentType); }
public void DetectDownloadContent() { HttpClientDownloader downloader = new HttpClientDownloader(); DefaultSpider spider = new DefaultSpider("abcd", new Site { }); downloader.Download(new Request("http://www.163.com", null), spider); Assert.Equal(Core.Infrastructure.ContentType.Html, spider.Site.ContentType); HttpClientDownloader2 downloader2 = new HttpClientDownloader2(); DefaultSpider spider2 = new DefaultSpider("abcd", new Site { }); downloader2.Download(new Request("http://www.163.com", null), spider2); Assert.Equal(Core.Infrastructure.ContentType.Json, spider2.Site.ContentType); }