File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,17 +109,26 @@ async function startLoadTest() {
109109
110110 // Test 4: Data Write / Document Insert
111111 if ( ! skipData ) {
112+ let insertBody = {
113+ Title : 'Load Test Post' ,
114+ userId : '6a650c2b6c4cae6fbf3204e6'
115+ } ;
116+ if ( args . payload ) {
117+ try {
118+ insertBody = typeof args . payload === 'string' ? JSON . parse ( args . payload ) : args . payload ;
119+ } catch ( e ) {
120+ console . warn ( '⚠️ Failed to parse --payload JSON. Using default payload.' ) ;
121+ }
122+ }
123+
112124 await runBenchmark ( `4. Document Insert (POST /api/data/${ collection } )` , {
113125 url : `${ target } /api/data/${ collection } ` ,
114126 method : 'POST' ,
115127 headers : {
116128 'x-api-key' : apiKey ,
117129 'content-type' : 'application/json' ,
118130 } ,
119- body : {
120- title : 'Load Test Post' ,
121- content : 'Benchmarking database write performance' ,
122- } ,
131+ body : insertBody ,
123132 } ) ;
124133 }
125134
You can’t perform that action at this time.
0 commit comments