{ "protocol": "http", "port": 4545, "name": "ServiceA", "numberOfRequests": 0, "recordRequests": true, "requests": [ ], "defaultResponse": { "statusCode": 404 }, "stubs": [ { "predicates": [ { "endsWith": { "path": "/test" } }, { "equals": { "method": "POST" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] }, { "matches": { "body": ".*" } } ], "responses": [ { "is": { "statusCode": 201, "body": { "status": "Success", "message": "POST request received for sample payload" } } } ] }, { "predicates": [ { "endsWith": { "path": "/test" } }, { "equals": { "method": "GET" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] } ], "responses": [ { "is": { "statusCode": 200, "body": { "status": "Success" } } } ] }, { "predicates": [ { "contains": { "path": "/multitenancy" } }, { "equals": { "method": "GET" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] } ], "responses": [ { "is": { "statusCode": 200, "body": { "status": "Success" } } } ] }, { "predicates": [ { "endsWith": { "path": "/test" } }, { "equals": { "method": "PUT" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] }, { "matches": { "body": ".*" } } ], "responses": [ { "is": { "statusCode": 201, "body": { "status": "Success", "message": "PUT request received for sample payload" } } } ] }, { "predicates": [ { "endsWith": { "path": "/test" } }, { "equals": { "method": "DELETE" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] } ], "responses": [ { "is": { "statusCode": 204, "body": { "status": "Success", "message": "DELETE request received" } } } ] }, { "predicates": [ { "endsWith": { "path": "/test/checkpermission" } }, { "equals": { "method": "GET" } }, { "or": [ { "contains": { "headers": { "cookie": "edi_session" } } }, { "startsWith": { "headers": { "authorization": "bearer" } } } ] }, { "inject": "function (config) {\r\n\r\n var base64DecodedIntrospectValue = Buffer.from(config.request.headers[\"edisp-introspect-value\"], \"base64\").toString();\r\n\tvar orgList = JSON.parse(base64DecodedIntrospectValue )[\"organizations\"][\"organizationList\"];\r\n\r\n\tfor (let i in orgList) { \r\n\t\tif(orgList[i][\"organizationId\"] === config.request.headers[\"edisp-org-id\"])\r\n\t\t{\r\n\t\t\treturn !orgList[i][\"permissions\"].includes(config.request.headers[\"permission-name\"]); \r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}" } ], "responses": [ { "is": { "statusCode": 403, "body": { "status": "Forbidden", "message": "Access Forbidden" } } } ] } ] }