@@ -71,7 +71,7 @@ export const codeSampleGenerators: CodeSampleGenerator[] = [
7171 const bodyString = body ? `\n${ body } ` : '' ;
7272
7373 const httpRequest = `${ method . toUpperCase ( ) } ${ decodeURI ( processedPath ) } HTTP/1.1
74- Host: ${ origin . replaceAll ( / h t t p s * : \/ \/ / g, '' ) }
74+ Host: ${ origin . replace ( / h t t p s * : \/ \/ / g, '' ) }
7575${ headerString } ${ bodyString } `;
7676
7777 return httpRequest ;
@@ -174,9 +174,9 @@ ${headerString}${bodyString}`;
174174 generate : ( { method, url : { origin, path } , headers, body } ) => {
175175 const contentType = headers ?. [ 'Content-Type' ] ;
176176 const needsJsonImport = body && isJSON ( contentType ) && typeof body === 'string' ;
177-
177+
178178 let code = '' ;
179-
179+
180180 // Import statements
181181 if ( needsJsonImport ) {
182182 code += 'import json\n' ;
@@ -428,9 +428,9 @@ const BodyGenerators = {
428428 } ,
429429 2
430430 )
431- . replaceAll ( '"$ $__TRUE__$$"' , 'True' )
432- . replaceAll ( '"$ $__FALSE__$$"' , 'False' )
433- . replaceAll ( '"$ $__NULL__$$"' , 'None' ) ;
431+ . replace ( / " \\ $ \\ $ _ _ T R U E _ _ \\ $ \\ $ " / g , 'True' )
432+ . replace ( / " \\ $ \\ $ _ _ F A L S E _ _ \\ $ \\ $ " / g , 'False' )
433+ . replace ( / " \\ $ \\ $ _ _ N U L L _ _ \\ $ \\ $ " / g , 'None' ) ;
434434 } else {
435435 // For everything else (including JSON strings)
436436 body = stringifyOpenAPI (
@@ -449,9 +449,9 @@ const BodyGenerators = {
449449 } ,
450450 2
451451 )
452- . replaceAll ( '"$ $__TRUE__$$"' , 'True' )
453- . replaceAll ( '"$ $__FALSE__$$"' , 'False' )
454- . replaceAll ( '"$ $__NULL__$$"' , 'None' ) ;
452+ . replace ( / " \\ $ \\ $ _ _ T R U E _ _ \\ $ \\ $ " / g , 'True' )
453+ . replace ( / " \\ $ \\ $ _ _ F A L S E _ _ \\ $ \\ $ " / g , 'False' )
454+ . replace ( / " \\ $ \\ $ _ _ N U L L _ _ \\ $ \\ $ " / g , 'None' ) ;
455455 }
456456
457457 return { body, code, headers } ;
@@ -554,9 +554,7 @@ function buildHeredoc(lines: string[]): string {
554554function convertPathParametersToPlaceholders ( urlPath : string ) : string {
555555 return urlPath . replace ( / \{ ( [ ^ } ] + ) \} / g, ( match , paramName ) => {
556556 // Convert camelCase to UPPER_SNAKE_CASE
557- const placeholder = paramName
558- . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1_$2' )
559- . toUpperCase ( ) ;
557+ const placeholder = paramName . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1_$2' ) . toUpperCase ( ) ;
560558 return `YOUR_${ placeholder } ` ;
561559 } ) ;
562560}
@@ -578,7 +576,10 @@ function processHeadersWithPlaceholders(headers?: Record<string, string>): Recor
578576 processedHeaders [ key ] = 'Basic YOUR_API_TOKEN' ;
579577 } else if ( value . includes ( 'YOUR_' ) || value . includes ( 'TOKEN' ) ) {
580578 // Already in correct format or generic token
581- processedHeaders [ key ] = value . replace ( / Y O U R _ S E C R E T _ T O K E N | Y O U R _ T O K E N / g, 'YOUR_API_TOKEN' ) ;
579+ processedHeaders [ key ] = value . replace (
580+ / Y O U R _ S E C R E T _ T O K E N | Y O U R _ T O K E N / g,
581+ 'YOUR_API_TOKEN'
582+ ) ;
582583 } else {
583584 // Regular headers - keep as-is
584585 processedHeaders [ key ] = value ;
0 commit comments