Features: p:http-request

p:http-request 121 (NW)

If you don’t specify a boundary, one will be created for you.

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/check-multipart"
                   method="post"
                   headers="map { 'content-type': 'multipart/mixed' }">
      <p:with-input>
         <p:inline>
            <doc1/>
         </p:inline>
         <p:inline>
            <doc2/>
         </p:inline>
      </p:with-input>
   </p:http-request>
</p:declare-step>

Result

<check-multipart xmlns:t="http://xproc.org/ns/testsuite/3.0"
                 method="POST"
                 boundary="B7fa9e9fd-4d3b-466d-991b-5b4e1a378a55" content-type="multipart/mixed">
   <header name="accept_encoding">gzip, x-gzip, deflate, br</header>
   <part>
      <header name="Content-Disposition">attachment</header>
      <header name="Content-Type">application/xml; charset=UTF-8</header>
      <body xml-declaration='xml version="1.0" encoding="UTF-8"'>
         <doc1 xmlns:err="http://www.w3.org/ns/xproc-error"/>
      </body>
   </part>
   <part>
      <header name="Content-Disposition">attachment</header>
      <header name="Content-Type">application/xml; charset=UTF-8</header>
      <body xml-declaration='xml version="1.0" encoding="UTF-8"'>
         <doc2 xmlns:err="http://www.w3.org/ns/xproc-error"/>
      </body>
   </part>
</check-multipart>

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::check-multipart">The pipeline root is not check-multipart.</s:assert>
         <s:assert test="string(@boundary) != ''">The boundary is wrong.</s:assert>
         <s:assert test="@content-type = 'multipart/mixed'">The content-type is wrong.</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
Multipart boundary test for p:http-request.