summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-misused-pseudoheaders.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-07-31 14:10:24 -0700
committerJames M Snell <jasnell@gmail.com>2017-08-04 12:57:13 -0700
commitb484ea1fabdbcf965d471dc8ef3dc64564e798e4 (patch)
tree7a7b27d86eb4de02a181e6ac9a5112c9cc891ad1 /test/parallel/test-http2-misused-pseudoheaders.js
parent59e509808aeb85e33a16756764f2b496d5b8fcdd (diff)
downloadandroid-node-v8-b484ea1fabdbcf965d471dc8ef3dc64564e798e4.tar.gz
android-node-v8-b484ea1fabdbcf965d471dc8ef3dc64564e798e4.tar.bz2
android-node-v8-b484ea1fabdbcf965d471dc8ef3dc64564e798e4.zip
http2: refactor trailers API
Rather than using the `'fetchTrailers'` event to collect trailers, a new `getTrailers` callback option is supported. If not set, the internals will skip calling out for trailers at all. Expands the test to make sure trailers work from the client side also. PR-URL: https://github.com/nodejs/node/pull/14239 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-misused-pseudoheaders.js')
-rw-r--r--test/parallel/test-http2-misused-pseudoheaders.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/parallel/test-http2-misused-pseudoheaders.js b/test/parallel/test-http2-misused-pseudoheaders.js
index 94475519cb..c3eb69c5f2 100644
--- a/test/parallel/test-http2-misused-pseudoheaders.js
+++ b/test/parallel/test-http2-misused-pseudoheaders.js
@@ -27,12 +27,10 @@ function onStream(stream, headers, flags) {
stream.respond({
'content-type': 'text/html',
':status': 200
- });
-
- // This will cause an error to be emitted on the stream because
- // using a pseudo-header in a trailer is forbidden.
- stream.on('fetchTrailers', (trailers) => {
- trailers[':status'] = 'bar';
+ }, {
+ getTrailers: common.mustCall((trailers) => {
+ trailers[':status'] = 'bar';
+ })
});
stream.on('error', common.expectsError({