11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// Tests the assertValidPseudoHeader function that is used within the 81cb0ef41Sopenharmony_ci// mapToHeaders function. The assert function is not exported so we 91cb0ef41Sopenharmony_ci// have to test it through mapToHeaders 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst { mapToHeaders } = require('internal/http2/util'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci// These should not throw 141cb0ef41Sopenharmony_cimapToHeaders({ ':status': 'a' }); 151cb0ef41Sopenharmony_cimapToHeaders({ ':path': 'a' }); 161cb0ef41Sopenharmony_cimapToHeaders({ ':authority': 'a' }); 171cb0ef41Sopenharmony_cimapToHeaders({ ':scheme': 'a' }); 181cb0ef41Sopenharmony_cimapToHeaders({ ':method': 'a' }); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciassert.throws(() => mapToHeaders({ ':foo': 'a' }), { 211cb0ef41Sopenharmony_ci code: 'ERR_HTTP2_INVALID_PSEUDOHEADER', 221cb0ef41Sopenharmony_ci name: 'TypeError', 231cb0ef41Sopenharmony_ci message: '":foo" is an invalid pseudoheader or is used incorrectly' 241cb0ef41Sopenharmony_ci}); 25