0

Say this is my router config

<apikit:config name="apiConfig" raml="api.raml" doc:name="Router" >
   <apikit:flow-mapping resource="/resourceOne" action="get" flow-ref="flow-1"/>
   <apikit:flow-mapping resource="/resourceTwo" action="post" flow-ref="flow-1"/>
</apikit:config>

As you can see the calls to these two resources are being redirected to the same flow, but based on the method action.

How do I read this action value (Get or Post) in the called flow flow-1?

Thinker-101
  • 554
  • 5
  • 19
  • 1
    Why are you mapping flows manually instead of using auto generated flows which is the default and recommended mode? – aled Jul 14 '22 at 17:09

1 Answers1

2

I believe you should be having separate flows, but if you need to it this way, you can use #[attributes.method] to get the method of the HTTP Request. The APIKIT router will forward the same event that the HTTP Listener will receive, so it will contain HTTPRequestAttributes. For more info you can refer this section HTTP Request Example

Harshank Bansal
  • 2,798
  • 2
  • 7
  • 22