1
1
/* **
2
2
* ==++==
3
3
*
4
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
7
7
* You may obtain a copy of the License at
8
8
* http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ using namespace Windows::Storage;
33
33
#include " cpprest/http_listener.h"
34
34
#endif
35
35
36
- using namespace web ;
36
+ using namespace web ;
37
37
using namespace utility ;
38
38
using namespace concurrency ;
39
39
using namespace web ::http;
@@ -101,7 +101,7 @@ TEST_FIXTURE(uri_address, set_response_stream_producer_consumer_buffer)
101
101
memset (chars, 0 , sizeof (chars));
102
102
103
103
rwbuf.getn ((unsigned char *)chars, rwbuf.in_avail ()).get ();
104
- VERIFY_ARE_EQUAL (0 , strcmp (" This is just a bit of a string" , chars));
104
+ VERIFY_ARE_EQUAL (0 , strcmp (" This is just a bit of a string" , chars));
105
105
}
106
106
107
107
TEST_FIXTURE (uri_address, set_response_stream_container_buffer)
@@ -179,7 +179,7 @@ TEST_FIXTURE(uri_address, response_stream_file_stream_close_early)
179
179
{
180
180
// The test needs to be a little different between desktop and WinRT.
181
181
// In the latter case, the server will not see a message, and so the
182
- // test will hang. In order to prevent that from happening, we will
182
+ // test will hang. In order to prevent that from happening, we will
183
183
// not have a server listening on WinRT.
184
184
#if !defined(__cplusplus_winrt)
185
185
test_http_server::scoped_server scoped (m_uri);
@@ -202,14 +202,14 @@ TEST_FIXTURE(uri_address, response_stream_file_stream_close_early)
202
202
fstream.close (std::make_exception_ptr (std::exception ())).wait ();
203
203
204
204
http_response resp;
205
-
205
+
206
206
VERIFY_THROWS ((resp = client.request (msg).get (), resp.content_ready ().get ()), std::exception);
207
207
}
208
208
209
- TEST_FIXTURE (uri_address, response_stream_large_file_stream)
209
+ TEST_FIXTURE (uri_address, response_stream_large_file_stream, " Ignore:Windows " , " 314 " )
210
210
{
211
211
// Send a 100 KB data in the response body, the server will send this in multiple chunks
212
- // This data will get sent with content-length
212
+ // This data will get sent with content-length
213
213
const size_t workload_size = 100 * 1024 ;
214
214
utility::string_t fname (U (" response_stream_large_file_stream.txt" ));
215
215
std::string responseData;
@@ -219,12 +219,12 @@ TEST_FIXTURE(uri_address, response_stream_large_file_stream)
219
219
test_http_server * p_server = scoped.server ();
220
220
221
221
http_client client (m_uri);
222
-
222
+
223
223
p_server->next_request ().then ([&](test_request *p_request)
224
224
{
225
225
std::map<utility::string_t , utility::string_t > headers;
226
226
headers[U (" Content-Type" )] = U (" text/plain" );
227
-
227
+
228
228
p_request->reply (200 , U (" " ), headers, responseData);
229
229
});
230
230
@@ -344,10 +344,10 @@ TEST_FIXTURE(uri_address, content_ready)
344
344
streams::producer_consumer_buffer<uint8_t > buf;
345
345
http_response response (200 );
346
346
response.set_body (buf.create_istream (), U (" text/plain" ));
347
- response.headers ().add (header_names::connection, U (" close" ));
347
+ response.headers ().add (header_names::connection, U (" close" ));
348
348
349
349
request.reply (response);
350
-
350
+
351
351
VERIFY_ARE_EQUAL (buf.putn ((const uint8_t *)responseData.data (), responseData.size ()).get (), responseData.size ());
352
352
buf.close (std::ios_base::out).get ();
353
353
});
@@ -384,8 +384,8 @@ TEST_FIXTURE(uri_address, xfer_chunked_with_length)
384
384
// add chunked transfer encoding
385
385
response.headers ().add (header_names::transfer_encoding, U (" chunked" ));
386
386
387
- // add connection=close header, connection SHOULD NOT be considered ` persistent' after the current request/response is complete
388
- response.headers ().add (header_names::connection, U (" close" ));
387
+ // add connection=close header, connection SHOULD NOT be considered persistent' after the current request/response is complete
388
+ response.headers ().add (header_names::connection, U (" close" ));
389
389
390
390
// respond
391
391
request.reply (response);
@@ -415,7 +415,7 @@ TEST_FIXTURE(uri_address, get_resp_stream)
415
415
416
416
http_response response (200 );
417
417
response.set_body (buf.create_istream (), U (" text/plain" ));
418
- response.headers ().add (header_names::connection, U (" close" ));
418
+ response.headers ().add (header_names::connection, U (" close" ));
419
419
request.reply (response);
420
420
421
421
VERIFY_ARE_EQUAL (buf.putn ((const uint8_t *)responseData.data (), responseData.size ()).get (), responseData.size ());
@@ -430,15 +430,15 @@ TEST_FIXTURE(uri_address, get_resp_stream)
430
430
431
431
auto t = rsp.body ().read_to_delim (data, (uint8_t )(' ' ));
432
432
433
- t.then ([&data](size_t size)
434
- {
433
+ t.then ([&data](size_t size)
434
+ {
435
435
VERIFY_ARE_EQUAL (size, 5 );
436
436
auto s = data.collection ();
437
437
VERIFY_ARE_EQUAL (s, std::string (" Hello" ));
438
438
}).wait ();
439
439
rsp.content_ready ().wait ();
440
440
}
441
-
441
+
442
442
listener.close ().wait ();
443
443
}
444
444
@@ -447,7 +447,7 @@ TEST_FIXTURE(uri_address, xfer_chunked_multiple_chunks)
447
447
// With chunked transfer-encoding, send 2 chunks of different sizes in the response
448
448
http_client client (m_uri);
449
449
450
- // Send two chunks, note: second chunk is bigger than the first.
450
+ // Send two chunks, note: second chunk is bigger than the first.
451
451
std::string firstChunk (" abcdefghijklmnopqrst" );
452
452
std::string secondChunk (" abcdefghijklmnopqrstuvwxyz" );
453
453
@@ -459,7 +459,7 @@ TEST_FIXTURE(uri_address, xfer_chunked_multiple_chunks)
459
459
460
460
http_response response (200 );
461
461
response.set_body (buf.create_istream (), U (" text/plain" ));
462
- response.headers ().add (header_names::connection, U (" close" ));
462
+ response.headers ().add (header_names::connection, U (" close" ));
463
463
request.reply (response);
464
464
465
465
VERIFY_ARE_EQUAL (buf.putn ((const uint8_t *)firstChunk.data (), firstChunk.size ()).get (), firstChunk.size ());
0 commit comments