-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9039f11
commit d7a7254
Showing
11 changed files
with
130 additions
and
1 deletion.
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
30 changes: 30 additions & 0 deletions
30
x-pack/test/alerting_api_integration/common/lib/get_proxy_server.ts
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,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import httpProxy from 'http-proxy'; | ||
|
||
export const getHttpProxyServer = ( | ||
targetUrl: string, | ||
onProxyResHandler: (proxyRes?: unknown, req?: unknown, res?: unknown) => void | ||
): httpProxy => { | ||
const proxyServer = httpProxy.createProxyServer({ | ||
target: targetUrl, | ||
secure: false, | ||
selfHandleResponse: false, | ||
}); | ||
proxyServer.on('proxyRes', (proxyRes: unknown, req: unknown, res: unknown) => { | ||
onProxyResHandler(proxyRes, req, res); | ||
}); | ||
return proxyServer; | ||
}; | ||
|
||
export const getProxyUrl = (kbnTestServerConfig: any) => { | ||
const proxySlackSimulatorURL = kbnTestServerConfig | ||
.find((val: string) => val.startsWith('--xpack.actions.proxyUrl=')) | ||
.replace('--xpack.actions.proxyUrl=', ''); | ||
|
||
return new URL(proxySlackSimulatorURL); | ||
}; |
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
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
Oops, something went wrong.