-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: excludeProxyList Interceptor AnWeber/vscode-httpyac#176
- Loading branch information
Showing
9 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as models from '../../../models'; | ||
import { HookTriggerContext } from 'hookpoint'; | ||
|
||
export const excludeProxyInterceptor = { | ||
id: 'excludeProxy', | ||
afterLoop: async function excludeProxy( | ||
hookContext: HookTriggerContext<[models.Request, models.ProcessorContext], void> | ||
): Promise<boolean> { | ||
const [request, context] = hookContext.args; | ||
if (!request.proxy) { | ||
request.proxy = context.config?.proxy; | ||
} | ||
|
||
if (request.proxy) { | ||
if (context.httpRegion.metaData.noProxy) { | ||
delete request.proxy; | ||
} else if (context.config?.proxyExcludeList) { | ||
if (context.config.proxyExcludeList.some(proxyExclude => request.url.startsWith(proxyExclude))) { | ||
delete request.proxy; | ||
} | ||
} | ||
} | ||
return true; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters