Skip to content

Commit 56ec952

Browse files
committed
No need to close the body explicitly with 'write_head' on dispose
1 parent cb9122a commit 56ec952

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

src/valum-router.vala

-6
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,6 @@ namespace Valum {
405405
}
406406
break;
407407
}
408-
409-
try {
410-
res.body.close ();
411-
} catch (IOError io_err) {
412-
warning (io_err.message);
413-
}
414408
}
415409
}
416410

tests/router-test.vala

-8
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ public static void test_router_success_created () {
354354

355355
assert (Soup.Status.CREATED == response.status);
356356
assert ("/document/5" == response.headers.get_one ("Location"));
357-
assert (response.head_written);
358357
}
359358

360359
/**
@@ -393,7 +392,6 @@ public static void test_router_redirection () {
393392

394393
assert (response.status == Soup.Status.MOVED_TEMPORARILY);
395394
assert ("http://example.com" == response.headers.get_one ("Location"));
396-
assert (response.head_written);
397395
}
398396

399397
/**
@@ -417,7 +415,6 @@ public static void test_router_client_error_method_not_allowed () {
417415

418416
assert (Soup.Status.METHOD_NOT_ALLOWED == response.status);
419417
assert ("POST" == response.headers.get_one ("Allow"));
420-
assert (response.head_written);
421418
}
422419

423420
/**
@@ -437,7 +434,6 @@ public static void test_router_client_error_upgrade_required () {
437434

438435
assert (426 == response.status);
439436
assert ("HTTP/1.1" == response.headers.get_one ("Upgrade"));
440-
assert (response.head_written);
441437
}
442438

443439
/**
@@ -459,7 +455,6 @@ public static void test_router_server_error () {
459455
HashTable<string, string> @params;
460456

461457
assert (response.status == Soup.Status.INTERNAL_SERVER_ERROR);
462-
assert (response.head_written);
463458
assert ("text/plain" == response.headers.get_content_type (out @params));
464459
assert ("charset" in @params);
465460
assert ("utf-8" == @params["charset"]);
@@ -506,7 +501,6 @@ public static void test_router_method_not_allowed () {
506501

507502
assert (response.status == 405);
508503
assert ("GET, PUT" == response.headers.get_one ("Allow"));
509-
assert (response.head_written);
510504
}
511505

512506
/**
@@ -538,7 +532,6 @@ public static void test_router_method_not_allowed_excludes_request_method () {
538532

539533
assert (response.status == 405);
540534
assert ("GET" == response.headers.get_one ("Allow"));
541-
assert (response.head_written);
542535
}
543536

544537
/**
@@ -553,7 +546,6 @@ public static void test_router_not_found () {
553546
router.handle (request, response);
554547

555548
assert (Soup.Status.NOT_FOUND == response.status);
556-
assert (response.head_written);
557549
}
558550

559551

0 commit comments

Comments
 (0)