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

Fix ab-http-request-061 #407

Merged
merged 1 commit into from Mar 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 66 additions & 10 deletions test-suite/tests/ab-http-request-061.xml
@@ -1,9 +1,20 @@
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
xmlns:err="http://www.w3.org/ns/xproc-error"
expected="fail" code="err:XC0127">
expected="pass">
<t:info>
<t:title>http-request-061 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2020-03-18</t:date>
<t:author>
<t:name>Norman Tovey-Walsh</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Changed the header to be in the correct namespace. Changed the test so
that it passes as the spec now explicitly states that the comparisons must
be performed in a case-insensitive manner.</p>
</t:description>
</t:revision>
<t:revision>
<t:date>2020-01-14</t:date>
<t:author>
Expand All @@ -16,18 +27,63 @@
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Tests p:http-request: XC0127 has to be raised, if two effective headers are case insensive equal.</p>
<p>Tests that document property headers are only used if the headers option
doesn’t specify a header with the same name.</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0" xmlns:p="http://www.w3.org/ns/xproc">
<p:declare-step version="3.0" xmlns:p="http://www.w3.org/ns/xproc"
xmlns:chttp="http://www.w3.org/ns/xproc-http">
<p:output port="result" />

<p:http-request href="http://tests.xproc.org/service/echo" method="post"
headers="map{'header' : 'value'}">
<p:with-input>
<p:inline document-properties="map{'HEADER' : 'value'}"><doc /></p:inline>
</p:with-input>

<p:http-request name="one"
href="http://tests.xproc.org/service/echoheaders"
method="post"
headers="map{'header' : 'value1'}">
<p:with-input>
<p:inline><doc /></p:inline>
</p:with-input>
</p:http-request>

<p:http-request name="two"
href="http://tests.xproc.org/service/echoheaders"
method="post">
<p:with-input>
<p:inline document-properties="map{'chttp:HEADER' : 'value2'}"><doc /></p:inline>
</p:with-input>
</p:http-request>

<p:http-request name="three"
href="http://tests.xproc.org/service/echoheaders"
method="post"
headers="map{'header' : 'value1'}">
<p:with-input>
<p:inline document-properties="map{'chttp:HEADER' : 'value2'}"><doc /></p:inline>
</p:with-input>
</p:http-request>

<p:wrap-sequence wrapper="headers">
<p:with-input port="source" pipe="@one @two @three"/>
</p:wrap-sequence>

</p:declare-step>
</t:pipeline>
</t:test>

<t:schematron>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
<s:pattern>
<s:rule context="/">
<s:assert test="headers">The root element is not 'doc'.</s:assert>
</s:rule>
<s:rule context="/headers">
<s:assert test="count(headers)=3">Wrong number of responses.</s:assert>
<s:assert test="headers[1]/header[@name='HEADER']/@value = 'value1'"
>First request gets incorrect header value.</s:assert>
<s:assert test="headers[2]/header[@name='HEADER']/@value = 'value2'"
>Second request gets incorrect header value.</s:assert>
<s:assert test="headers[3]/header[@name='HEADER']/@value = 'value1'"
>Third request gets incorrect header value.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>