This repository was archived by the owner on Dec 14, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,13 @@ async function isIgnoreAPI(params, options) {
216216 if ( ! apiPath && ! policyName ) {
217217 return { status : 400 , body : { message : 'You must either provide the apiPath or the policyName used to read the configuration.' } } ;
218218 }
219+ debugger ;
220+ if ( apiPath && apiPath . startsWith ( "%{[" ) && apiPath . endsWith ( "]}" ) ) {
221+ return { status : 400 , body : { message : `API-Path contains unresolved Logstash variable: '${ apiPath } '. Please check Logstash pipeline configuration.` } } ;
222+ }
223+ if ( policyName && policyName . startsWith ( "%{[" ) && policyName . endsWith ( "]}" ) ) {
224+ return { status : 400 , body : { message : `Policy-Name contains unresolved Logstash variable: '${ policyName } '. Please check Logstash pipeline configuration.` } } ;
225+ }
219226 if ( region ) {
220227 region = region . toLowerCase ( ) ;
221228 params . region = region ;
Original file line number Diff line number Diff line change @@ -86,5 +86,19 @@ describe('Test is Index-API', () => {
8686 expect ( value . status ) . to . equal ( 200 ) ;
8787 expect ( output ) . to . equal ( 'next' ) ;
8888 } ) ;
89+
90+ it ( '[isIgnoreAPI-0006] should return an error if the apiPath contains an unresolved Logstash variable' , async ( ) => {
91+ const { value, output } = await flowNode . isIgnoreAPI ( { policyName : "%{[transact-something-in-the-middle-ri]}" } ) ;
92+
93+ expect ( value ) . to . deep . equal ( { status : 400 , body : { message : "Policy-Name contains unresolved Logstash variable: '%{[transact-something-in-the-middle-ri]}'. Please check Logstash pipeline configuration." } } ) ;
94+ expect ( output ) . to . equal ( 'next' ) ;
95+ } ) ;
96+
97+ it ( '[isIgnoreAPI-0006] should return an error if the apiPath contains an unresolved Logstash variable' , async ( ) => {
98+ const { value, output } = await flowNode . isIgnoreAPI ( { apiPath : "%{[transact-something-in-the-middle-ri]}" } ) ;
99+
100+ expect ( value ) . to . deep . equal ( { status : 400 , body : { message : "API-Path contains unresolved Logstash variable: '%{[transact-something-in-the-middle-ri]}'. Please check Logstash pipeline configuration." } } ) ;
101+ expect ( output ) . to . equal ( 'next' ) ;
102+ } ) ;
89103 } ) ;
90104} ) ;
You can’t perform that action at this time.
0 commit comments