henvic / httpretty

Package httpretty prints the HTTP requests you make with Go pretty on your terminal.
https://asciinema.org/a/297429
MIT License
398 stars 16 forks source link

Custom header sanitization #14

Open chrishas35 opened 2 years ago

chrishas35 commented 2 years ago

I have a module that calls an API with a custom authorization header. I would like to sanitize it rather than hide it, but currently doesn't appear I can do so. The ability to add additional headers for sanitization would be a great addition.

henvic commented 2 years ago

Hello @chrishas35,

Sorry for the delay in getting back to you. I just noticed your comment today.

Thanks. I'll consider it in an upcoming update.

For now, maybe something like the following works for you:

wedeploy.DefaultSanitizers["Custom-Header"] = AuthorizationSanitizer

as you can see in:

https://github.com/henvic/httpretty/blob/f741004e44b444fe2c2c141fd723221ab08a7f8a/internal/header/header.go#L37-L43

titaneric commented 1 week ago

May I ask how to use it? It seems that it's internal package.