|
1 | 1 | mod tests {
|
2 | 2 | use ic_certificate_verification::CertificateVerificationError;
|
3 | 3 | use ic_certification_testing::{CertificateBuilder, CertificateData};
|
4 |
| - use ic_http_certification::{HttpRequest, HttpResponse, StatusCode, CERTIFICATE_HEADER_NAME}; |
| 4 | + use ic_http_certification::{HttpRequest, HttpResponse, CERTIFICATE_HEADER_NAME}; |
5 | 5 | use ic_response_verification::types::{VerificationInfo, VerifiedResponse};
|
6 | 6 | use ic_response_verification::verify_request_response_pair;
|
7 | 7 | use ic_response_verification::ResponseVerificationError;
|
@@ -41,11 +41,11 @@ mod tests {
|
41 | 41 |
|
42 | 42 | let request = HttpRequest::get(path).build();
|
43 | 43 |
|
44 |
| - let response = HttpResponse::builder() |
45 |
| - .with_status_code(StatusCode::OK) |
46 |
| - .with_body(body.as_bytes()) |
47 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
48 |
| - .build(); |
| 44 | + let response = HttpResponse::ok( |
| 45 | + body.as_bytes(), |
| 46 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 47 | + ) |
| 48 | + .build(); |
49 | 49 | let expected_response = VerifiedResponse {
|
50 | 50 | status_code: None,
|
51 | 51 | body: response.body().to_vec(),
|
@@ -99,11 +99,11 @@ mod tests {
|
99 | 99 |
|
100 | 100 | let request = HttpRequest::get(encoded_path).build();
|
101 | 101 |
|
102 |
| - let response = HttpResponse::builder() |
103 |
| - .with_status_code(StatusCode::OK) |
104 |
| - .with_body(body.as_bytes()) |
105 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
106 |
| - .build(); |
| 102 | + let response = HttpResponse::ok( |
| 103 | + body.as_bytes(), |
| 104 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 105 | + ) |
| 106 | + .build(); |
107 | 107 | let expected_response = VerifiedResponse {
|
108 | 108 | status_code: None,
|
109 | 109 | body: response.body().to_vec(),
|
@@ -156,11 +156,11 @@ mod tests {
|
156 | 156 |
|
157 | 157 | let request = HttpRequest::get("/").build();
|
158 | 158 |
|
159 |
| - let response = HttpResponse::builder() |
160 |
| - .with_status_code(StatusCode::OK) |
161 |
| - .with_body(body.as_bytes()) |
162 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
163 |
| - .build(); |
| 159 | + let response = HttpResponse::ok( |
| 160 | + body.as_bytes(), |
| 161 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 162 | + ) |
| 163 | + .build(); |
164 | 164 | let expected_response = VerifiedResponse {
|
165 | 165 | status_code: None,
|
166 | 166 | body: response.body().to_vec(),
|
@@ -213,11 +213,11 @@ mod tests {
|
213 | 213 |
|
214 | 214 | let request = HttpRequest::get(path).build();
|
215 | 215 |
|
216 |
| - let response = HttpResponse::builder() |
217 |
| - .with_status_code(StatusCode::OK) |
218 |
| - .with_body(b"Hello IC!") |
219 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
220 |
| - .build(); |
| 216 | + let response = HttpResponse::ok( |
| 217 | + b"Hello IC!", |
| 218 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 219 | + ) |
| 220 | + .build(); |
221 | 221 |
|
222 | 222 | let result = verify_request_response_pair(
|
223 | 223 | request,
|
@@ -262,11 +262,11 @@ mod tests {
|
262 | 262 |
|
263 | 263 | let request = HttpRequest::get(path).build();
|
264 | 264 |
|
265 |
| - let response = HttpResponse::builder() |
266 |
| - .with_status_code(StatusCode::OK) |
267 |
| - .with_body(body.as_bytes()) |
268 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
269 |
| - .build(); |
| 265 | + let response = HttpResponse::ok( |
| 266 | + body.as_bytes(), |
| 267 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 268 | + ) |
| 269 | + .build(); |
270 | 270 |
|
271 | 271 | let result = verify_request_response_pair(
|
272 | 272 | request,
|
@@ -315,11 +315,11 @@ mod tests {
|
315 | 315 |
|
316 | 316 | let request = HttpRequest::get(path).build();
|
317 | 317 |
|
318 |
| - let response = HttpResponse::builder() |
319 |
| - .with_status_code(StatusCode::OK) |
320 |
| - .with_body(body.as_bytes()) |
321 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
322 |
| - .build(); |
| 318 | + let response = HttpResponse::ok( |
| 319 | + body.as_bytes(), |
| 320 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 321 | + ) |
| 322 | + .build(); |
323 | 323 |
|
324 | 324 | let result = verify_request_response_pair(
|
325 | 325 | request,
|
@@ -370,11 +370,11 @@ mod tests {
|
370 | 370 |
|
371 | 371 | let request = HttpRequest::get(path).build();
|
372 | 372 |
|
373 |
| - let response = HttpResponse::builder() |
374 |
| - .with_status_code(StatusCode::OK) |
375 |
| - .with_body(body.as_bytes()) |
376 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
377 |
| - .build(); |
| 373 | + let response = HttpResponse::ok( |
| 374 | + body.as_bytes(), |
| 375 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 376 | + ) |
| 377 | + .build(); |
378 | 378 |
|
379 | 379 | let result = verify_request_response_pair(
|
380 | 380 | request,
|
@@ -423,11 +423,11 @@ mod tests {
|
423 | 423 |
|
424 | 424 | let request = HttpRequest::get(path).build();
|
425 | 425 |
|
426 |
| - let response = HttpResponse::builder() |
427 |
| - .with_status_code(StatusCode::OK) |
428 |
| - .with_body(body.as_bytes()) |
429 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
430 |
| - .build(); |
| 426 | + let response = HttpResponse::ok( |
| 427 | + body.as_bytes(), |
| 428 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 429 | + ) |
| 430 | + .build(); |
431 | 431 |
|
432 | 432 | let result = verify_request_response_pair(
|
433 | 433 | request,
|
@@ -473,11 +473,11 @@ mod tests {
|
473 | 473 |
|
474 | 474 | let request = HttpRequest::get(path).build();
|
475 | 475 |
|
476 |
| - let response = HttpResponse::builder() |
477 |
| - .with_status_code(StatusCode::OK) |
478 |
| - .with_body(body.as_bytes()) |
479 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
480 |
| - .build(); |
| 476 | + let response = HttpResponse::ok( |
| 477 | + body.as_bytes(), |
| 478 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 479 | + ) |
| 480 | + .build(); |
481 | 481 |
|
482 | 482 | let result = verify_request_response_pair(
|
483 | 483 | request,
|
@@ -521,11 +521,11 @@ mod tests {
|
521 | 521 |
|
522 | 522 | let request = HttpRequest::get(path).build();
|
523 | 523 |
|
524 |
| - let response = HttpResponse::builder() |
525 |
| - .with_status_code(StatusCode::OK) |
526 |
| - .with_body(body.as_bytes()) |
527 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
528 |
| - .build(); |
| 524 | + let response = HttpResponse::ok( |
| 525 | + body.as_bytes(), |
| 526 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 527 | + ) |
| 528 | + .build(); |
529 | 529 |
|
530 | 530 | let result = verify_request_response_pair(
|
531 | 531 | request,
|
@@ -569,11 +569,11 @@ mod tests {
|
569 | 569 |
|
570 | 570 | let request = HttpRequest::get(path).build();
|
571 | 571 |
|
572 |
| - let response = HttpResponse::builder() |
573 |
| - .with_status_code(StatusCode::OK) |
574 |
| - .with_body(body.as_bytes()) |
575 |
| - .with_headers(vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)]) |
576 |
| - .build(); |
| 572 | + let response = HttpResponse::ok( |
| 573 | + body.as_bytes(), |
| 574 | + vec![(CERTIFICATE_HEADER_NAME.into(), certificate_header)], |
| 575 | + ) |
| 576 | + .build(); |
577 | 577 |
|
578 | 578 | let result = verify_request_response_pair(
|
579 | 579 | request,
|
|
0 commit comments