Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix appending rnd query parameter to URLs in benchmark-server-timing #165

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions cli/commands/benchmark-server-timing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ function benchmarkURL( params ) {
const metrics = {};
const responseTimes = [];
let completeRequests = 0;
let requestNum = 0;

const onHeaders = ( { headers } ) => {
const responseMetrics = getServerTimingMetricsFromHeaders( headers );
Expand All @@ -154,9 +153,11 @@ function benchmarkURL( params ) {
requests: [
{
setupRequest( req ) {
const url = new URL( req.path, 'http://localhost' ); // The base doesn't matter since we're only manipulating the path.
url.searchParams.set( 'rnd', String( Math.random() ) );
return {
...req,
path: `${ req.path }?rnd=${ requestNum++ }`,
path: url.pathname + url.search,
};
},
},
Expand Down