You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					15 lines
				
				353 B
			
		
		
			
		
	
	
					15 lines
				
				353 B
			| 
								 
											3 years ago
										 
									 | 
							
								'use strict'
							 | 
						||
| 
								 | 
							
								const fastRedact = require('..')
							 | 
						||
| 
								 | 
							
								const fauxRequest = {
							 | 
						||
| 
								 | 
							
								  headers: {
							 | 
						||
| 
								 | 
							
								    host: 'http://example.com',
							 | 
						||
| 
								 | 
							
								    cookie: `oh oh we don't want this exposed in logs in etc.`,
							 | 
						||
| 
								 | 
							
								    referer: `if we're cool maybe we'll even redact this`
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								const redact = fastRedact({
							 | 
						||
| 
								 | 
							
								  paths: ['headers.cookie', 'headers.referer']
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								console.log(redact(fauxRequest))
							 |