Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add test case for #404 #406

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<APIProxy revision="1" name="BN001-xsd-resources">
<ConfigurationVersion minorVersion="0" majorVersion="4"/>
<CreatedAt>1489339923158</CreatedAt>
<CreatedBy>dino</CreatedBy>
<Description/>
<DisplayName>BN001-xsd-resources</DisplayName>
<LastModifiedAt>1489340418969</LastModifiedAt>
<LastModifiedBy>orgAdmin</LastModifiedBy>
<TargetEndpoints/>
</APIProxy>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<AssignMessage name='AM-CleanResponseHeaders'>
<Remove>
<Headers/>
</Remove>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<AssignMessage name="AM-InjectProxyVersionHeader">
<Set>
<Headers>
<Header name="apiproxy">{apiproxy.name} r{apiproxy.revision}</Header>
</Headers>
</Set>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<AssignMessage name='AM-Response-1'>

<AssignVariable>
<Name>t</Name>
<Template>{timeFormatUTCMs(propertyset.set1.timeformat,system.timestamp)}</Template>
</AssignVariable>

<AssignVariable>
<Name>d</Name>
<Template>{timeFormatUTCMs(propertyset.set1.dateformat,system.timestamp)}</Template>
</AssignVariable>

<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Set>
<Payload contentType='application/json'>{
"status" : "ok",
"time" : "{t}",
"date" : "{d}"
}</Payload>
<ReasonPhrase>OK</ReasonPhrase>
<StatusCode>200</StatusCode>
</Set>
<AssignTo>response</AssignTo>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Javascript name='JS-1' timeLimit='200' >
<Source>
function getProp(setname, shortpropname) {
try {
var name = 'propertyset.' + setname + '.' + shortpropname;
var c = String(context.getVariable(name));
return c;
}
catch (e) {
return String(e);
}
}
var keys = ['value1','value2','bailiwick','identifier']
keys.forEach(function(k) {getProp('set1',k);});
</Source>
</Javascript>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<MessageValidation name="MV-1">
<Source>message</Source>
<ResourceURL>xsd://ProduceService.xsd</ResourceURL>
</MessageValidation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<RaiseFault name='RF-UnknownRequest'>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<FaultResponse>
<Set>
<Payload contentType='application/json'>{
"error" : {
"code" : 404.01,
"message" : "that request was unknown; try a different request."
}
}
</Payload>
<StatusCode>404</StatusCode>
<ReasonPhrase>Not Found</ReasonPhrase>
</Set>
</FaultResponse>
</RaiseFault>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<ProxyEndpoint name="endpoint1">
<Description>Proxy Endpoint 1</Description>
<HTTPProxyConnection>
<BasePath>/BN001-propertiesset-demo1</BasePath>
<Properties/>
<VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>

<FaultRules/>
<DefaultFaultRule name="fault-rule">
<Step>
<Name>AM-InjectProxyVersionHeader</Name>
</Step>
<AlwaysEnforce>true</AlwaysEnforce>
</DefaultFaultRule>

<PreFlow name="PreFlow">
<Request>
<Step>
<Name>JS-1</Name>
</Step>
</Request>
<Response>
<Step>
<Name>AM-CleanResponseHeaders</Name>
</Step>
</Response>
</PreFlow>
<PostFlow name="PostFlow">
<Request>
</Request>
<Response>
<Step>
<Name>AM-InjectProxyVersionHeader</Name>
</Step>
</Response>
</PostFlow>
<PostClientFlow name="PostClientFlow">
<Request>
</Request>
<Response>
</Response>
</PostClientFlow>

<Flows>

<Flow name="flow1">
<Request>
<Step>
<Name>MV-1</Name>
</Step>
</Request>
<Response>
<Step>
<Name>AM-Response-1</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "POST")</Condition>
</Flow>

<Flow name="unknown request">
<Request>
<Step>
<Name>RF-UnknownRequest</Name>
</Step>
</Request>
<Response>
</Response>
</Flow>

</Flows>

<RouteRule name="NoRouteRule"/>

</ProxyEndpoint>
Loading