Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions benchmark/http/check_invalid_header_char.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const common = require('../common.js');
const _checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;

// Put it here so the benchmark result lines will not be super long.
const LONG_AND_INVALID = 'Here is a value that is really a folded header ' +
'value\r\n this should be \supported, but it is not currently';

const bench = common.createBenchmark(main, {
key: [
// Valid
Expand All @@ -21,8 +25,7 @@ const bench = common.createBenchmark(main, {
'en-US',

// Invalid
'Here is a value that is really a folded header value\r\n this should be \
supported, but it is not currently',
'LONG_AND_INVALID',
'中文呢', // unicode
'foo\nbar',
'\x7F'
Expand All @@ -31,6 +34,9 @@ const bench = common.createBenchmark(main, {
});

function main({ n, key }) {
if (key == 'LONG_AND_INVALID') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: ===

key = LONG_AND_INVALID;
}
bench.start();
for (var i = 0; i < n; i++) {
_checkInvalidHeaderChar(key);
Expand Down