@@ -54,56 +54,56 @@ test.case("Url") {
54
54
55
55
test. case ( " InvalidRequest " ) {
56
56
let stream = InputByteStream ( " GET \r \n \r \n " )
57
- expect ( throws: Error . invalidStartLine) {
57
+ await expect ( throws: Error . invalidStartLine) {
58
58
try await Request . decode ( from: stream)
59
59
}
60
60
}
61
61
62
62
test. case ( " InvalidRequest2 " ) {
63
63
let stream = InputByteStream ( " GET \r \n \r \n " )
64
- expect ( throws: Error . invalidStartLine) {
64
+ await expect ( throws: Error . invalidStartLine) {
65
65
try await Request . decode ( from: stream)
66
66
}
67
67
}
68
68
69
69
test. case ( " InvalidMethod " ) {
70
70
let stream = InputByteStream ( " BAD /test HTTP/1.1 \r \n \r \n " )
71
- expect ( throws: Error . invalidMethod) {
71
+ await expect ( throws: Error . invalidMethod) {
72
72
try await Request . decode ( from: stream)
73
73
}
74
74
}
75
75
76
76
test. case ( " InvalidVersion " ) {
77
77
let stream = InputByteStream ( " GET /test HTTP/0.1 \r \n \r \n " )
78
- expect ( throws: Error . invalidVersion) {
78
+ await expect ( throws: Error . invalidVersion) {
79
79
try await Request . decode ( from: stream)
80
80
}
81
81
}
82
82
83
83
test. case ( " InvalidVersion2 " ) {
84
84
let stream = InputByteStream ( " GET /test HTTP/1.1WUT \r \n \r \n " )
85
- expect ( throws: Error . invalidRequest) {
85
+ await expect ( throws: Error . invalidRequest) {
86
86
try await Request . decode ( from: stream)
87
87
}
88
88
}
89
89
90
90
test. case ( " InvalidVersion3 " ) {
91
91
let stream = InputByteStream ( " GET /test HTTP/1. " )
92
- expect ( throws: Error . unexpectedEnd) {
92
+ await expect ( throws: Error . unexpectedEnd) {
93
93
try await Request . decode ( from: stream)
94
94
}
95
95
}
96
96
97
97
test. case ( " InvalidVersion4 " ) {
98
98
let stream = InputByteStream ( " GET /test HTPP/1.1 \r \n \r \n " )
99
- expect ( throws: Error . invalidVersion) {
99
+ await expect ( throws: Error . invalidVersion) {
100
100
try await Request . decode ( from: stream)
101
101
}
102
102
}
103
103
104
104
test. case ( " InvalidEnd " ) {
105
105
let stream = InputByteStream ( " GET /test HTTP/1.1 \r \n " )
106
- expect ( throws: Error . unexpectedEnd) {
106
+ await expect ( throws: Error . unexpectedEnd) {
107
107
try await Request . decode ( from: stream)
108
108
}
109
109
}
@@ -258,7 +258,7 @@ test.case("InvalidHeaderColon") {
258
258
" GET / HTTP/1.1 \r \n " +
259
259
" User-Agent; Mozilla/5.0 \r \n " +
260
260
" \r \n " )
261
- expect ( throws: Error . invalidHeaderName) {
261
+ await expect ( throws: Error . invalidHeaderName) {
262
262
try await Request . decode ( from: stream)
263
263
}
264
264
}
@@ -267,7 +267,7 @@ test.case("InvalidHeaderEnd") {
267
267
let stream = InputByteStream (
268
268
" GET / HTTP/1.1 \r \n " +
269
269
" User-Agent: Mozilla/5.0 \n \n " )
270
- expect ( throws: Error . unexpectedEnd) {
270
+ await expect ( throws: Error . unexpectedEnd) {
271
271
try await Request . decode ( from: stream)
272
272
}
273
273
}
@@ -277,7 +277,7 @@ test.case("InvalidHeaderName") {
277
277
" GET / HTTP/1.1 \r \n " +
278
278
" See-🙈-Evil: No \r \n " +
279
279
" \r \n " )
280
- expect ( throws: Error . invalidHeaderName) {
280
+ await expect ( throws: Error . invalidHeaderName) {
281
281
try await Request . decode ( from: stream)
282
282
}
283
283
}
@@ -292,7 +292,7 @@ test.case("UnexpectedEnd") {
292
292
let stream = InputByteStream (
293
293
" GET / HTTP/1.1 \r \n " +
294
294
" Header: Value \r \n " )
295
- expect ( throws: Error . unexpectedEnd) {
295
+ await expect ( throws: Error . unexpectedEnd) {
296
296
try await Request . decode ( from: stream)
297
297
}
298
298
}
@@ -329,7 +329,7 @@ test.case("ContentTypeEmptyCharset") {
329
329
" Content-Type: text/plain; \r \n " +
330
330
" Content-Length: 0 \r \n " +
331
331
" \r \n " )
332
- expect ( throws: Error . invalidContentTypeHeader) {
332
+ await expect ( throws: Error . invalidContentTypeHeader) {
333
333
try await Request . decode ( from: stream)
334
334
}
335
335
}
@@ -355,7 +355,7 @@ test.case("ContentTypeEmptyBoundary") {
355
355
" Content-Type: multipart/form-data; \r \n " +
356
356
" Content-Length: 0 \r \n " +
357
357
" \r \n " )
358
- expect ( throws: Error . invalidBoundary) {
358
+ await expect ( throws: Error . invalidBoundary) {
359
359
try await Request . decode ( from: stream)
360
360
}
361
361
}
@@ -439,7 +439,7 @@ test.case("CookiesNoSpace") {
439
439
" GET / HTTP/1.1 \r \n " +
440
440
" Cookie: username=tony;lang=aurebesh \r \n " +
441
441
" \r \n " )
442
- expect ( throws: Error . invalidRequest) {
442
+ await expect ( throws: Error . invalidRequest) {
443
443
try await Request . decode ( from: stream)
444
444
}
445
445
}
@@ -449,7 +449,7 @@ test.case("CookiesTrailingSemicolon") {
449
449
" GET / HTTP/1.1 \r \n " +
450
450
" Cookie: username=tony; \r \n " +
451
451
" \r \n " )
452
- expect ( throws: Error . invalidRequest) {
452
+ await expect ( throws: Error . invalidRequest) {
453
453
try await Request . decode ( from: stream)
454
454
}
455
455
}
@@ -506,7 +506,7 @@ test.case("BodyChunkedInvalidSizeSeparator") {
506
506
" 5 \r Hello \r \n " +
507
507
" 0 \r \n \r \n " )
508
508
let request = try await Request . decode ( from: stream)
509
- expect ( throws: Error . invalidRequest) {
509
+ await expect ( throws: Error . invalidRequest) {
510
510
_ = try await request. readBody ( )
511
511
}
512
512
}
@@ -519,7 +519,7 @@ test.case("BodyChunkedNoSizeSeparator") {
519
519
" 5 Hello \r \n " +
520
520
" 0 \r \n \r \n " )
521
521
let request = try await Request . decode ( from: stream)
522
- expect ( throws: Error . invalidRequest) {
522
+ await expect ( throws: Error . invalidRequest) {
523
523
_ = try await request. readBody ( )
524
524
}
525
525
}
@@ -532,7 +532,7 @@ test.case("BodyChunkedMissingLineEnd") {
532
532
" 5 \r \n Hello \r \n " +
533
533
" 0 \r \n " )
534
534
let request = try await Request . decode ( from: stream)
535
- expect ( throws: Error . unexpectedEnd) {
535
+ await expect ( throws: Error . unexpectedEnd) {
536
536
_ = try await request. readBody ( )
537
537
}
538
538
}
@@ -544,7 +544,7 @@ test.case("BodyChunkedInvalidBody") {
544
544
" \r \n " +
545
545
" 5 \r \n Hello " )
546
546
let request = try await Request . decode ( from: stream)
547
- expect ( throws: Error . unexpectedEnd) {
547
+ await expect ( throws: Error . unexpectedEnd) {
548
548
_ = try await request. readBody ( )
549
549
}
550
550
}
0 commit comments