@@ -357,7 +357,7 @@ class TestURLSession: LoopbackServerTest {
357
357
config. timeoutIntervalForRequest = 5
358
358
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /requestHeaders "
359
359
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
360
- var expect = expectation ( description: " POST \( urlString) : get request headers " )
360
+ let expect = expectation ( description: " POST \( urlString) : get request headers " )
361
361
var req = URLRequest ( url: URL ( string: urlString) !)
362
362
let headers = [ " header1 " : " value1 " ]
363
363
req. httpMethod = " POST "
@@ -384,7 +384,7 @@ class TestURLSession: LoopbackServerTest {
384
384
config. httpAdditionalHeaders = [ " header2 " : " svalue2 " , " header3 " : " svalue3 " , " header4 " : " svalue4 " ]
385
385
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /requestHeaders "
386
386
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
387
- var expect = expectation ( description: " POST \( urlString) with additional headers " )
387
+ let expect = expectation ( description: " POST \( urlString) with additional headers " )
388
388
var req = URLRequest ( url: URL ( string: urlString) !)
389
389
let headers = [ " header1 " : " rvalue1 " , " header2 " : " rvalue2 " , " Header4 " : " rvalue4 " ]
390
390
req. httpMethod = " POST "
@@ -411,7 +411,7 @@ class TestURLSession: LoopbackServerTest {
411
411
config. timeoutIntervalForRequest = 5
412
412
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /Peru "
413
413
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
414
- var expect = expectation ( description: " GET \( urlString) : no timeout " )
414
+ let expect = expectation ( description: " GET \( urlString) : no timeout " )
415
415
let req = URLRequest ( url: URL ( string: urlString) !)
416
416
let task = session. dataTask ( with: req) { ( data, _, error) -> Void in
417
417
defer { expect. fulfill ( ) }
@@ -427,7 +427,7 @@ class TestURLSession: LoopbackServerTest {
427
427
config. timeoutIntervalForRequest = 10
428
428
let urlString = " http://127.0.0.1:-1/Peru "
429
429
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
430
- var expect = expectation ( description: " GET \( urlString) : will timeout " )
430
+ let expect = expectation ( description: " GET \( urlString) : will timeout " )
431
431
var req = URLRequest ( url: URL ( string: " http://127.0.0.1:-1/Peru " ) !)
432
432
req. timeoutInterval = 1
433
433
let task = session. dataTask ( with: req) { ( data, _, error) -> Void in
@@ -754,7 +754,7 @@ class TestURLSession: LoopbackServerTest {
754
754
var req = URLRequest ( url: URL ( string: urlString) !)
755
755
req. timeoutInterval = 3
756
756
let config = URLSessionConfiguration . default
757
- var expect = expectation ( description: " GET \( urlString) : timeout with redirection " )
757
+ let expect = expectation ( description: " GET \( urlString) : timeout with redirection " )
758
758
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
759
759
let task = session. dataTask ( with: req) { data, response, error in
760
760
defer { expect. fulfill ( ) }
@@ -1176,7 +1176,7 @@ class TestURLSession: LoopbackServerTest {
1176
1176
XCTAssertEqual ( config. httpCookieStorage? . cookies? . count, 0 )
1177
1177
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /requestCookies "
1178
1178
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
1179
- var expect = expectation ( description: " POST \( urlString) " )
1179
+ let expect = expectation ( description: " POST \( urlString) " )
1180
1180
var req = URLRequest ( url: URL ( string: urlString) !)
1181
1181
req. httpMethod = " POST "
1182
1182
let task = session. dataTask ( with: req) { ( data, response, error) -> Void in
@@ -1201,7 +1201,7 @@ class TestURLSession: LoopbackServerTest {
1201
1201
emptyCookieStorage ( storage: config. httpCookieStorage)
1202
1202
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /requestCookies "
1203
1203
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
1204
- var expect = expectation ( description: " POST \( urlString) " )
1204
+ let expect = expectation ( description: " POST \( urlString) " )
1205
1205
var req = URLRequest ( url: URL ( string: urlString) !)
1206
1206
req. httpMethod = " POST "
1207
1207
let task = session. dataTask ( with: req) { ( data, response, error) -> Void in
@@ -1226,7 +1226,7 @@ class TestURLSession: LoopbackServerTest {
1226
1226
emptyCookieStorage ( storage: config. httpCookieStorage)
1227
1227
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /redirectToEchoHeaders "
1228
1228
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
1229
- var expect = expectation ( description: " POST \( urlString) " )
1229
+ let expect = expectation ( description: " POST \( urlString) " )
1230
1230
let req = URLRequest ( url: URL ( string: urlString) !)
1231
1231
let task = session. dataTask ( with: req) { ( data, _, error) -> Void in
1232
1232
defer { expect. fulfill ( ) }
@@ -1294,7 +1294,7 @@ class TestURLSession: LoopbackServerTest {
1294
1294
1295
1295
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /requestCookies "
1296
1296
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
1297
- var expect = expectation ( description: " POST \( urlString) " )
1297
+ let expect = expectation ( description: " POST \( urlString) " )
1298
1298
var req = URLRequest ( url: URL ( string: urlString) !)
1299
1299
req. httpMethod = " POST "
1300
1300
let task = session. dataTask ( with: req) { ( data, _, error) -> Void in
@@ -1404,7 +1404,7 @@ class TestURLSession: LoopbackServerTest {
1404
1404
config. timeoutIntervalForRequest = 5
1405
1405
let urlString = " http://127.0.0.1: \( TestURLSession . serverPort) /emptyPost "
1406
1406
let session = URLSession ( configuration: config, delegate: nil , delegateQueue: nil )
1407
- var expect = expectation ( description: " POST \( urlString) : post with empty body " )
1407
+ let expect = expectation ( description: " POST \( urlString) : post with empty body " )
1408
1408
var req = URLRequest ( url: URL ( string: urlString) !)
1409
1409
req. httpMethod = " POST "
1410
1410
let task = session. dataTask ( with: req) { ( _, response, error) -> Void in
0 commit comments