Features: p:http-request

p:http-request 133 (NW)

Test timeout on p:http-request when fail-on-timeout is false.

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 method="get"
                   href="{$WHOST}/service/slow" assert="true()"
                   parameters="map{'timeout': 2, 'fail-on-timeout': false()}">
      <p:with-input>
         <p:empty/>
      </p:with-input>
   </p:http-request>
   
   <p:identity>
      <p:with-input pipe="report"/>
   </p:identity>
   <p:identity>
      <p:with-input>
         <code>{.?status-code}</code>
      </p:with-input>
   </p:identity>
</p:declare-step>

Result

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

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:pattern>
      <s:rule context="/">
         <s:assert test="code">Root element is not 'code'.</s:assert>
         <s:assert test=". = '408'">The status code is not 408.</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.
26 Dec 2024, Norman Walsh
Initial commit.