Skip to content

Commit 575889b

Browse files
committed
refactor: extract repeated strings.ToUpper call into variable
Address PR review feedback by storing the uppercase protocol name in a local variable instead of calling strings.ToUpper three times. Made-with: Cursor
1 parent 8e067ee commit 575889b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cmd/interactsh-client/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,10 @@ func main() {
225225
}
226226
case "http", "https":
227227
if noFilter || cliOptions.HTTPOnly {
228-
fmt.Fprintf(builder, "[%s] Received %s interaction from %s at %s", interaction.FullId, strings.ToUpper(interaction.Protocol), interaction.RemoteAddress, interaction.Timestamp.Format("2006-01-02 15:04:05"))
228+
proto := strings.ToUpper(interaction.Protocol)
229+
fmt.Fprintf(builder, "[%s] Received %s interaction from %s at %s", interaction.FullId, proto, interaction.RemoteAddress, interaction.Timestamp.Format("2006-01-02 15:04:05"))
229230
if cliOptions.Verbose {
230-
fmt.Fprintf(builder, "\n------------\n%s Request\n------------\n\n%s\n\n-------------\n%s Response\n-------------\n\n%s\n\n", strings.ToUpper(interaction.Protocol), interaction.RawRequest, strings.ToUpper(interaction.Protocol), interaction.RawResponse)
231+
fmt.Fprintf(builder, "\n------------\n%s Request\n------------\n\n%s\n\n-------------\n%s Response\n-------------\n\n%s\n\n", proto, interaction.RawRequest, proto, interaction.RawResponse)
231232
}
232233
writeOutput(outputFile, builder)
233234
}

0 commit comments

Comments
 (0)