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.

It requires the following features: p:http-request.

The pipeline


<p:declare-step xmlns:chttp="http://www.w3.org/ns/xproc-http" xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:http-request name="one" href="http://localhost:8246/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://localhost:8246/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://localhost:8246/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>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <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

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

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.