You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/02 15:05:07 UTC

[GitHub] dubee closed pull request #3907: Fix for exception being thrown during api creation

dubee closed pull request #3907: Fix for exception being thrown during api creation
URL: https://github.com/apache/incubator-openwhisk/pull/3907
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/routemgmt/common/apigw-utils.js b/core/routemgmt/common/apigw-utils.js
index 84d4104c15..8187633ab3 100644
--- a/core/routemgmt/common/apigw-utils.js
+++ b/core/routemgmt/common/apigw-utils.js
@@ -41,7 +41,7 @@ function generateTargetUrlMap(ibmConfig) {
         var execs = element['execute'];
         //each nth element of execs and operations go together, so lets add those to the map.
         for (var i = 0; i < operations.length ; ++i) {
-          if(i < execs.length && execs[i] && execs[i]['invoke']['target-url']) {
+          if(i < execs.length && execs[i] && execs[i]['invoke'] && execs[i]['invoke']['target-url']) {
             targetUrls[operations[i]] = execs[i]['invoke']['target-url'];
           }
         }
diff --git a/tests/dat/apigw/testswaggerdoc1 b/tests/dat/apigw/testswaggerdoc1
index 623ae43c54..c515477925 100644
--- a/tests/dat/apigw/testswaggerdoc1
+++ b/tests/dat/apigw/testswaggerdoc1
@@ -21,6 +21,38 @@
                     "url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http"
                 }
             }
+        },
+        "/pathSecure1": {
+            "get": {
+                "operationId": "get_/pathSecure1",
+                "responses": {
+                    "default": {
+                        "description": "Default response"
+                    }
+                },
+                "x-openwhisk": {
+                    "action": "CLI_APIGWTEST7_action",
+                    "namespace": "whisk.system",
+                    "package": "",
+                    "url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http"
+                }
+            }
+        },
+        "/pathSecure2": {
+            "get": {
+                "operationId": "get_/pathSecure2",
+                "responses": {
+                    "default": {
+                        "description": "Default response"
+                    }
+                },
+                "x-openwhisk": {
+                    "action": "CLI_APIGWTEST7_action",
+                    "namespace": "whisk.system",
+                    "package": "",
+                    "url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http"
+                }
+            }
         }
     },
     "x-ibm-configuration": {
@@ -51,6 +83,52 @@
                                 "operations": [
                                     "get_/path"
                                 ]
+                            },
+                            {
+                                "execute": [
+                                    {
+                                        "invoke": {
+                                            "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http",
+                                            "verb": "keep"
+                                        }
+                                    },
+                                    {
+                                        "set-variable": {
+                                            "actions": [
+                                                {
+                                                    "set": "message.headers.X-Require-Whisk-Auth",
+                                                    "value": "my-secret"
+                                                }
+                                            ]
+                                        }
+                                    }
+                                ],
+                                "operations": [
+                                    "get_/pathSecure1"
+                                ]
+                            },
+                            {
+                                "execute": [
+                                    {
+                                        "set-variable": {
+                                            "actions": [
+                                                {
+                                                    "set": "message.headers.X-Require-Whisk-Auth",
+                                                    "value": "my-secret"
+                                                }
+                                            ]
+                                        }
+                                    },
+                                    {
+                                        "invoke": {
+                                            "target-url": "https://172.17.0.1/api/v1/web/whisk.system/default/CLI_APIGWTEST7_action.http",
+                                            "verb": "keep"
+                                        }
+                                    }
+                                ],
+                                "operations": [
+                                    "get_/pathSecure2"
+                                ]
                             }
                         ]
                     }
diff --git a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestBasicTests.scala b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestBasicTests.scala
index 97b903a4ca..0947225fff 100644
--- a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestBasicTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestBasicTests.scala
@@ -521,6 +521,8 @@ abstract class ApiGwRestBasicTests extends BaseApiGwTests {
     val testName = "CLI_APIGWTEST7"
     val testbasepath = "/" + testName + "_bp"
     val testrelpath = "/path"
+    val testrelpath1 = "/pathSecure1"
+    val testrelpath2 = "/pathSecure2"
     val testurlop = "get"
     val testapiname = testName + " API Name"
     val actionName = testName + "_action"
@@ -530,7 +532,8 @@ abstract class ApiGwRestBasicTests extends BaseApiGwTests {
       verifyApiCreated(rr)
       rr = apiList(basepathOrApiName = Some(testbasepath), relpath = Some(testrelpath), operation = Some(testurlop))
       verifyApiFullList(rr, "", actionName, testurlop, testbasepath, testrelpath, testapiname)
-
+      verifyApiFullList(rr, "", actionName, testurlop, testbasepath, testrelpath1, testapiname)
+      verifyApiFullList(rr, "", actionName, testurlop, testbasepath, testrelpath2, testapiname)
     } finally {
       apiDelete(basepathOrApiName = testbasepath, expectedExitCode = DONTCARE_EXIT)
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services