Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Setting a FormParam overwrites all form params from request

Not applicable

So I have an AssignMessage policy which is supposed to set a FormParam called "From".

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-Set-From">
   <DisplayName>AM - Set From</DisplayName>
      <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
      <AssignTo createNew="false" transport="http" type="request"/>
      <Set>
         <FormParams>
            <FormParam name="From"></FormParam> 
         </FormParams>
      </Set>
</AssignMessage>

The problem is that the request from the client already has 2 form parameters: "To" and "Body". But after this policy is executed in Edge, the only parameter is "From". So Edge is removing the given parameters and only keeping the one from the AssignMessage policy.

1 2 1,491
2 REPLIES 2

I tried to simulate this with your policy in my org... I don't see the issue (attached my proxy). It is a no-target proxy and will echo the message you send.

My sample request was -

$curl "http://MYORG-test.apigee.net/no-target-1" -d "To=destination&Body=hello" -X POST

and the proxy returns

To=destination&Body=hello&From=

no-target-1-rev2-2017-04-07.zip

anilsr
Former Googler

@JosephGalley , Welcome to Apigee Community !

I think it's the content type header , Make sure you set the header below,

Content-Type: application/x-www-form-urlencoded

I can able to reproduce your issue,

With above header,

4630-screen-shot-2017-04-09-at-40940-pm.png

With form-data example, without above header,

4631-screen-shot-2017-04-09-at-40958-pm.png

Hope it helps. Keep us posted if any.