@@ -748,6 +748,21 @@ class TestURLSession: LoopbackServerTest {
748
748
d. run ( with: url)
749
749
waitForExpectations ( timeout: 12 )
750
750
}
751
+
752
+ func test_httpRedirectionWithEncodedQuery( ) {
753
+ let location = " echo-query%3Fparam%3Dfoo " // "echo-query?param=foo" url encoded
754
+ let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /303?location= \( location) "
755
+ let url = URL ( string: urlString) !
756
+ let d = HTTPRedirectionDataTask ( with: expectation ( description: " GET \( urlString) : with HTTP redirection " ) )
757
+ d. run ( with: url)
758
+ waitForExpectations ( timeout: 12 )
759
+
760
+ if let body = String ( data: d. receivedData, encoding: . utf8) {
761
+ XCTAssertEqual ( body, " param=foo " )
762
+ } else {
763
+ XCTFail ( " No string body " )
764
+ }
765
+ }
751
766
752
767
// temporarily disabled (https://bugs.swift.org/browse/SR-5751)
753
768
func test_httpRedirectionTimeout( ) {
@@ -1774,6 +1789,7 @@ class TestURLSession: LoopbackServerTest {
1774
1789
( " test_httpRedirectionWithCompleteRelativePath " , test_httpRedirectionWithCompleteRelativePath) ,
1775
1790
( " test_httpRedirectionWithInCompleteRelativePath " , test_httpRedirectionWithInCompleteRelativePath) ,
1776
1791
( " test_httpRedirectionWithDefaultPort " , test_httpRedirectionWithDefaultPort) ,
1792
+ ( " test_httpRedirectionWithEncodedQuery " , test_httpRedirectionWithEncodedQuery) ,
1777
1793
( " test_httpRedirectionTimeout " , test_httpRedirectionTimeout) ,
1778
1794
( " test_httpRedirectionChainInheritsTimeoutInterval " , test_httpRedirectionChainInheritsTimeoutInterval) ,
1779
1795
( " test_httpRedirectionExceededMaxRedirects " , test_httpRedirectionExceededMaxRedirects) ,
0 commit comments