Skip to content

Commit

Permalink
[Backport 4.5-7.10] Fix error of request body parameter suggestions i…
Browse files Browse the repository at this point in the history
…n API Console (#5534)

Fix error of request body parameter suggestions in API Console (#5521)

* fix(api-console): error in request body paremeters of API Console

* changelog: add pull request entry

(cherry picked from commit a1b8eb2)

Co-authored-by: Antonio <34042064+Desvelao@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and Desvelao authored Jun 12, 2023
1 parent b23a247 commit d1facf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed error when using invalid group configuration [#5423](https://github.com/wazuh/wazuh-kibana-app/pull/5423)
- Fixed repeated requests in inventory data and configurations of an agent. [#5460](https://github.com/wazuh/wazuh-kibana-app/pull/5460)
- Fixed repeated requests in the group table when adding a group or refreshing the table [#5465](https://github.com/wazuh/wazuh-kibana-app/pull/5465)
- Fixed an error in the request body suggestions of API Console [#5521](https://github.com/wazuh/wazuh-kibana-app/pull/5521)

### Removed

Expand Down
7 changes: 7 additions & 0 deletions public/controllers/dev-tools/dev-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,13 @@ export class DevToolsController {
hints = model.map(a => a.method);
}
const final_hints = hints.map(chain => {
/* This avoids the errors when the hint is not a string.
The request body parameters is an object and the chain.replace
statement causes an error
*/
if(typeof chain !== 'string' ){
return chain;
};
let t = 0;
return chain = chain.replace(/\?/g, (match) => {
t++;
Expand Down

0 comments on commit d1facf3

Please sign in to comment.