Features: p:http-request

p:http-request 130 (NW)

If send-body-anyway is explicitly true, the body is sent. This tests HEAD.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-inline-prefixes="c xs"
                version="3.0">
   <p:output port="result"/>
   <p:option name="WHOST"
             select="'http://localhost:8246'" static="true"/>
   <p:http-request href="{$WHOST}/service/head-with-body"
                   method="head"
                   parameters="map{'send-body-anyway': true()}">
      <p:with-input>
         <doc1/>
      </p:with-input>
   </p:http-request>
   <p:identity>
      <p:with-input pipe="report"/>
   </p:identity>
   <p:identity>
      <p:with-input>
         <result>{.?status-code}</result>
      </p:with-input>
   </p:identity>
</p:declare-step>

Result

<result xmlns:err="http://www.w3.org/ns/xproc-error"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">202</result>

Schematron checks

<s:schema xmlns="http://www.w3.org/1999/xhtml"
          xmlns:err="http://www.w3.org/ns/xproc-error"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          queryBinding="xslt2">
   <s:ns prefix="p" uri="http://www.w3.org/ns/xproc"/>
   <s:ns prefix="c"
         uri="http://www.w3.org/ns/xproc-step"/>
   <s:pattern>
      <s:rule context="/*">
         <s:assert test="self::result">The root is not result.</s:assert>
         <s:assert test=".='202'">The resonse code is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

23 May 2025, Norm Tovey-Walsh
Added static options for web server host and port.
09 Sep 2021, Norman Walsh
Test send-body-anyway for p:http-request.