http-request-061 (AB)

Tests that document property headers are only used if the headers option doesn’t specify a header with the same name.

Test ab-http-request-061.xml is expected to pass.

The pipeline


      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>

         <p:http-request name="one" href="http://tests.xproc.org/service/echoheaders" method="post" headers="map{'header' : 'value1'}">
           <p:with-input>
             <p:inline><doc xmlns=""/></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 xmlns=""/></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 xmlns=""/></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>
   
MorganaXProc passing XML Calabash passing

Schematron validation


      <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>
   

Revision history

18 Mar 2020, Norman Tovey-Walsh

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.

14 Jan 2020, Achim Berndzen

Added new tests for p:http-request.