Created
February 12, 2018 19:33
-
-
Save Luidog/19de894330ab0d564bb56f29551b69bc to your computer and use it in GitHub Desktop.
HTTP Native ({request}) Status Code Patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<fmxmlsnippet type="FMObjectList"> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>PATCH Proposed By L.D. and E.M.</Text> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>--------------------------------------------------------------------------------------------</Text> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"/> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>define response code</Text> | |
</Step> | |
<Step enable="True" id="141" name="Set Variable"> | |
<Value> | |
<Calculation>"HTTP/"</Calculation> | |
</Value> | |
<Repetition> | |
<Calculation>1</Calculation> | |
</Repetition> | |
<Name>$responseCodePattern</Name> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"/> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>check for multiple response codes</Text> | |
</Step> | |
<Step enable="True" id="68" name="If"> | |
<Calculation>PatternCount ( $responseHeaders ; $responseCodePattern) > 1</Calculation> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>create trimmed response code</Text> | |
</Step> | |
<Step enable="True" id="141" name="Set Variable"> | |
<Value> | |
<Calculation>Let ( [ | |
pattern = $responseCodePattern; | |
headers = $responseHeaders; | |
len = Length ( headers ); | |
count = PatternCount ( headers ; pattern ); | |
pos = Position ( headers ; pattern ; 0 ; count ) | |
] ; | |
Middle ( headers ; pos ; len ) | |
)</Calculation> | |
</Value> | |
<Repetition> | |
<Calculation>1</Calculation> | |
</Repetition> | |
<Name>$trimmedResponseHeaders</Name> | |
</Step> | |
<Step enable="True" id="70" name="End If"/> | |
<Step enable="True" id="89" name="# (comment)"/> | |
<Step enable="True" id="141" name="Set Variable"> | |
<Value> | |
<Calculation>Let( | |
[ | |
line = If( not IsEmpty ( $trimmedResponseHeaders ) ; $trimmedResponseHeaders ; $responseHeaders ); | |
split = Substitute ( line ; " " ; "¶" ); | |
code = GetAsNumber (GetValue ( split ; 2 ) ) | |
]; | |
JSONSetElement ( "" ; | |
["message"; line ; JSONString ]; | |
["code"; code ; JSONNumber ] | |
) | |
)</Calculation> | |
</Value> | |
<Repetition> | |
<Calculation>1</Calculation> | |
</Repetition> | |
<Name>$status</Name> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"/> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text>--------------------------------------------------------------------------------------------</Text> | |
</Step> | |
<Step enable="True" id="89" name="# (comment)"> | |
<Text> End Patch</Text> | |
</Step> | |
</fmxmlsnippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment