When creating an api using response type http, the call path should always be forwarded to the web action.
Duplicate issue opened https://github.com/serverless/serverless-openwhisk/issues/136 To reproduce: ``` $ echo "const main = (p) => {return {body:p}}" >echoweb.js $ wsk action update echoweb echoweb.js --web true $ wsk api create /v1 /foo get echoweb --response-type http ok: created API /v1/foo GET for action /guest/echoweb http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo ``` The expected behavior is that the `__ow_path` always contains the basePath (/v1) plus the API Operation Path (/foo) and any Path appended to endpoint. ``` curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo | jq .__ow_path "" ``` Calling the endpoint `/v1/foo` it returns `""` it should be `/v1/foo` ``` $ curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo/bar | jq .__ow_path "/bar" ``` Calling the endpoint `/v1/foo` it returns `""` it should be `/v1/foo/bar` Inspecting the swagger definition the target url is missing the `$(request.path)` at the end after `echoweb.http` ``` wsk api get /v1 | grep target-url "target-url": "https://172.17.0.1/api/v1/web/guest/default/echoweb.http", ``` Recreating the API with a modified swagger to fix: ``` wsk api get /v1 > swagger.json ``` Changing the swagger to have end in `echoweb.http$(request.path)` ``` $ wsk api create -c swagger.json ok: created API /v1/foo get for action /guest/echoweb http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo ``` verify target-url: ``` $ wsk api get /v1 | grep target-url "target-url": "https://172.17.0.1/api/v1/web/guest/default/echoweb.http$(request.path)" ``` Then try the scenario again 😸 and it's fix ``` 🍰 $ curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo | jq .__ow_path "/v1/foo" ~/dev/whisk/git/apache/incubator-openwhisk (master) 💋 $ curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v1/foo/bar | jq .__ow_path "/v1/foo/bar" ``` If a path parameter syntax is used then this problem doesn't show up ``` $ wsk api create /v2 /foo2/{id}/friends get echoweb --response-type http ok: created API /v2/foo2/{id}/friends GET for action /guest/echoweb http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v2/foo2/{id}/friends $ curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v2/foo2/42/friends | jq .__ow_path "/v2/foo2/42/friends" $ curl -s http://172.17.0.1:9090/api/23bc46b1-71f6-4ed5-8c54-816aa4f8c502/v2/foo2/42/friends/first | jq .__ow_path "/v2/foo2/42/friends/first" ``` The swagger json doc is generated correct with the `$(request.path)` ``` $ wsk api get /v2 | grep target-url "target-url": "https://172.17.0.1/api/v1/web/guest/default/echoweb.http$(request.path)", ``` [ Full content available at: https://github.com/apache/incubator-openwhisk/issues/4055 ] This message was relayed via gitbox.apache.org for devnull@infra.apache.org