p:http-request 128 (NW)

If the documents in a mulitpart request have document properties in the http://www.w3.org/ns/xproc-http namespace, those properties become headers.

Test nw-http-request-128.xml is expected to pass.

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

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:xs="http://www.w3.org/2001/XMLSchema" exclude-inline-prefixes="c xs" version="3.0">
   <p:output port="result"/>
   <p:http-request xmlns:chttp="http://www.w3.org/ns/xproc-http" href="http://localhost:8246/service/check-multipart" method="post">
      <p:with-input>
         <p:inline document-properties="map{                    'chttp:content-id': 'abcdefg',                    'chttp:content-description': 'First document'                 }">
            <doc1/>
         </p:inline>
         <p:inline document-properties="map{                    'chttp:content-description': 'Second document',                    'chttp:content-disposition': 'attachment; filename=abc.xml',                    'chttp:random-header': 'value'                 }">
            <doc2/>
         </p:inline>
      </p:with-input>
   </p:http-request>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<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" 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 root is not check-multipart.</s:assert>
         <s:assert test="part[1]/header[lower-case(@name) = 'content-description'] = 'First document'">The content-description of the first part is incorrect.</s:assert>
         <s:assert test="part[1]/header[lower-case(@name) = 'content-id'] = 'abcdefg'">The content-id of the first part is incorrect.</s:assert>
         <s:assert test="part[2]/header[lower-case(@name) = 'content-description'] = 'Second document'">The content-description of the second part is incorrect.</s:assert>
         <s:assert test="part[2]/header[lower-case(@name) = 'content-disposition']                 = 'attachment; filename=abc.xml'">The content-disposition of the second part is incorrect.</s:assert>
         <s:assert test="part[2]/header[lower-case(@name) = 'random-header'] = 'value'">The random-header of the second part is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

09 Sep 2021, Norman Walsh

Check that xproc-http properties become headers in multipart documents.