Skip to content

Commit

Permalink
Fix appending rnd query param to path
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Nov 25, 2024
1 parent 6da568c commit e06b470
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit e06b470

Please sign in to comment.