| 1012 | } |
| 1013 | |
| 1014 | function closeHttp2 (client, server, callback) { |
| 1015 | if (typeof client.shutdown === 'function') { |
| 1016 | // this is the node v8.x way of closing the connections |
| 1017 | client.shutdown({}, function () { |
| 1018 | server.close(function () { |
| 1019 | callback() |
| 1020 | }) |
| 1021 | }) |
| 1022 | } else { |
| 1023 | // this is the node v9.x onwards way of closing the connections |
| 1024 | client.close(function () { |
| 1025 | // force existing connections to time out after 1ms. |
| 1026 | // this is done to force the server to close in some cases where it wouldn't do it otherwise. |
| 1027 | server.close(function () { |
| 1028 | callback() |
| 1029 | }) |
| 1030 | }) |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | function shouldHaveBodyLength (length) { |
| 1035 | return function (res) { |