openwhisk-apigateway icon indicating copy to clipboard operation
openwhisk-apigateway copied to clipboard

Adding Transform All policy for queries incorrectly removes query parameters in the backendUrl

Open alexsong93 opened this issue 8 years ago • 2 comments

According to the policy docs, to transform all query parameters to body, you would put this in policies:

{
    "action": "transform",
    "from": {
      "name": "*",
      "location": "query"
    },
    "to": {
      "name": "*",
      "location": "body"
    }
}

However, this also removes the query parameters in the backendUrl.

alexsong93 avatar Dec 14 '16 08:12 alexsong93

The backend query parameters are added to the query array at the beginning https://github.com/openwhisk/apigateway/blob/develop/api-gateway-config/scripts/lua/policies/mapping.lua#L63. The other query parameters were being added into the query array in addition to the backend query parameters. If ngx.var.backendUrl is still being set, I'll need to double check the order of the override.

DavidMGreen avatar Dec 14 '16 09:12 DavidMGreen

Is this now working as expected?

mhamann avatar Jun 29 '17 19:06 mhamann