How to get HTTP Status code in Mule 4

How to make your response payload downloadable as file to client in MuleSoft
Use cases:
- Client hits the API -> Flow Process happens here->Final Response is saved in a file and returned as response
Solution:
The solution is very simple. All you need to use is Set property component at the end of the flow and configure the Content-Disposition property like below

filename=MuleParsedFile_'+flowVars.filename: In the above example, The filename is fetched from the filename variable which is concatenated with MuleParsedFile_. The final file name will be something like below. You can form your own name
MuleParsedFile_file.txt
Syntax:
Property name: Content-Disposition
Property value: attachment; filename=<your file name goes here>
Example of Syntax:
Property name: Content-Disposition
Property value: #['attachment; filename=MuleParsedFile_'+flowVars.filename]
0 Comments