@@ -37,6 +37,7 @@ const ndjsonRef = {
3737 SourceInputMessage : { $ref : '#/components/schemas/SourceInputMessage' } ,
3838}
3939import { ndjsonResponse } from '@stripe/sync-ts-cli/ndjson'
40+ import { REQUEST_HEADER_REDACT } from '@stripe/sync-logger'
4041import { logger } from '../logger.js'
4142import {
4243 sslConfigFromConnectionString ,
@@ -142,28 +143,22 @@ export async function createApp(resolver: ConnectorResolver) {
142143 }
143144 } )
144145 logger . debug (
145- { requestId, method : c . req . method , path : c . req . path , headers } ,
146+ { requestId, method : c . req . method , path : c . req . path , request_headers : headers } ,
146147 'request headers'
147148 )
148149 }
149150 logger . info ( { requestId, method : c . req . method , path : c . req . path } , 'request start' )
150151 if ( dangerouslyVerbose ) {
151152 const curlParts = [ `curl -X ${ c . req . method } '${ c . req . url } '` ]
152153 c . req . raw . headers . forEach ( ( value , key ) => {
153- curlParts . push ( ` -H '${ key } : ${ value } '` )
154+ curlParts . push (
155+ REQUEST_HEADER_REDACT . has ( key . toLowerCase ( ) )
156+ ? ` -H '${ key } : [REDACTED]'`
157+ : ` -H '${ key } : ${ value } '`
158+ )
154159 } )
155160 if ( hasBody ( c ) ) {
156- const cl = c . req . header ( 'Content-Length' )
157- if ( cl && Number ( cl ) < 100_000 ) {
158- try {
159- const body = await c . req . raw . clone ( ) . text ( )
160- curlParts . push ( ` -d '${ body . replace ( / ' / g, "'\\''" ) } '` )
161- } catch {
162- /* skip */
163- }
164- } else {
165- curlParts . push ( ' --data-binary @-' )
166- }
161+ curlParts . push ( ' --data-binary @-' )
167162 }
168163 logger . debug ( curlParts . join ( ' \\\n' ) )
169164 }
0 commit comments