[8.10] [Actions] Adjust axios payload for APIs that do not want data sent (#165756) (#165851)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Actions] Adjust axios payload for APIs that do not want `data` sent
(#165756)](https://github.com/elastic/kibana/pull/165756)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2023-09-06T13:38:39Z","message":"[Actions]
Adjust axios payload for APIs that do not want `data` sent
(#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","v8.10.0","v8.11.0"],"number":165756,"url":"https://github.com/elastic/kibana/pull/165756","mergeCommit":{"message":"[Actions]
Adjust axios payload for APIs that do not want `data` sent
(#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165756","number":165756,"mergeCommit":{"message":"[Actions]
Adjust axios payload for APIs that do not want `data` sent
(#165756)","sha":"d6a2bd77788c318a9f74247a52a1b6da05779b4b"}}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
Kibana Machine 2023-09-06 11:30:37 -04:00 committed by GitHub
parent f5288ec004
commit b89394c241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 4 deletions

View file

@ -66,7 +66,6 @@ describe('request', () => {
expect(axiosMock).toHaveBeenCalledWith('/test', {
method: 'get',
data: {},
httpAgent: undefined,
httpsAgent: expect.any(HttpsAgent),
proxy: false,
@ -100,7 +99,6 @@ describe('request', () => {
expect(axiosMock).toHaveBeenCalledWith(TestUrl, {
method: 'get',
data: {},
httpAgent,
httpsAgent,
proxy: false,
@ -132,7 +130,6 @@ describe('request', () => {
expect(axiosMock).toHaveBeenCalledWith('https://testProxy', {
method: 'get',
data: {},
httpAgent: undefined,
httpsAgent: expect.any(HttpsAgent),
proxy: false,

View file

@ -51,7 +51,7 @@ export const request = async <T = unknown>({
...config,
method,
headers,
data: data ?? {},
...(data ? { data } : {}),
// use httpAgent and httpsAgent and set axios proxy: false, to be able to handle fail on invalid certs
httpAgent,
httpsAgent,