feat: setting to toggle insomnia user-agent [INS-4107]#7640
feat: setting to toggle insomnia user-agent [INS-4107]#7640filfreire merged 4 commits intoKong:developfrom
Conversation
There was a problem hiding this comment.
https://github.com/Kong/insomnia/pull/7640/files#diff-0d876a97684cc6c868835d083785c52894f879ce84216e92bdb0a9876d4abcafR577
I think the setting should be passed like the other objects here instead of using models.settings.getOrCreate() inside this function
1d7eb64 to
3f83003
Compare
|
@gatzjames, I submitted a second pass, please review again |
95f91f4 to
ac97db7
Compare
gatzjames
left a comment
There was a problem hiding this comment.
Nice one!
Tested with many variations of enabling/disabling this and works great!
| // cleanup orphan app/version user-agent headers | ||
| const existingAppVersionUserAgent: RequestHeader | null = headers.find((h: any) => h.name.toLowerCase() === 'user-agent' && h.disabled === false && h.value.startsWith('insomnia')) || null; | ||
| if (existingAppVersionUserAgent) { | ||
| headers.splice(headers.indexOf(existingAppVersionUserAgent), 1); |
There was a problem hiding this comment.
splice is a mutating function, and tough to reason about.
Its better to use a pure function and name the output to make your code easier to read.
|
Let's update this in such a way that it does not add the default Insomnia The checkbox should be renamed with "Do not add Insomnia User-Agent for new requests". |
ac97db7 to
35d5f43
Compare
0db33fe to
4ce4d3c
Compare
This PR adds a new setting that allows disabling adding the default insomnia app version user-agent to new requests.
related to INS-4107