| 800 | } |
| 801 | |
| 802 | void HttpRequestTest::testAddHeader() |
| 803 | { |
| 804 | auto request = std::make_shared<Request>(); |
| 805 | request->setUri("http://localhost/archives/aria2-1.0.0.tar.bz2"); |
| 806 | |
| 807 | HttpRequest httpRequest; |
| 808 | httpRequest.disableContentEncoding(); |
| 809 | httpRequest.setRequest(request); |
| 810 | httpRequest.setAuthConfigFactory(authConfigFactory_.get()); |
| 811 | httpRequest.setOption(option_.get()); |
| 812 | httpRequest.addHeader("X-ARIA2: v0.13\nX-ARIA2-DISTRIBUTE: enabled\n"); |
| 813 | httpRequest.addHeader("Accept: text/html"); |
| 814 | httpRequest.setNoWantDigest(true); |
| 815 | std::string expectedText = "GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n" |
| 816 | "User-Agent: aria2\r\n" |
| 817 | "Host: localhost\r\n" |
| 818 | "Pragma: no-cache\r\n" |
| 819 | "Cache-Control: no-cache\r\n" |
| 820 | "Connection: close\r\n" |
| 821 | "X-ARIA2: v0.13\r\n" |
| 822 | "X-ARIA2-DISTRIBUTE: enabled\r\n" |
| 823 | "Accept: text/html\r\n" |
| 824 | "\r\n"; |
| 825 | |
| 826 | CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest()); |
| 827 | } |
| 828 | |
| 829 | void HttpRequestTest::testAcceptMetalink() |
| 830 | { |
nothing calls this directly
no test coverage detected