<?xml-stylesheet type="text/xsl" href="/style/testcase.xsl"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">

<t:title>Test http-request multipart #002</t:title>

<t:pipeline>
<p:declare-step version='1.0' name="main">
  <p:output port="result"/>
  <p:http-request>
    <p:input port="source">
      <p:inline>
	<c:request method="post"
                   href="http://tests.xproc.org/service/check-multipart">
          <c:header name="Content-Type" value="multipart/related"/>
          <c:header name="X-mpp" value="mpp header"/>
          <c:multipart boundary="aaaabbbbccccddddeeefffggghhhiiijjjkkkllmmmnop" content-type="multipart/related">
            <c:body content-type="text/plain"
                    description="Some descriptive text">Hello World</c:body>
            <c:body content-type="text/plain"
                    description="Some descriptive text">Goodbye!</c:body>
            <c:body content-type="application/xml"
                    description="Some descriptive text">
              <doc/>
            </c:body>
          </c:multipart>
        </c:request>
      </p:inline>
    </p:input>
  </p:http-request>
</p:declare-step>
</t:pipeline>

<!-- N.B. Transformation of the X-mpp header to x_mpp is a feature -->
<!-- of the check-multipart service. For "feature" read "bug". :-) -->
<t:output port='result'>
<check-multipart boundary="aaaabbbbccccddddeeefffggghhhiiijjjkkkllmmmnop"
           content-type='multipart/related'>
   <header name="x_mpp">mpp header</header>
   <part>
      <header name="Content-Description">Some descriptive text</header>
      <header name="Content-Type">text/plain; charset=utf-8</header>
      <body>Hello World
</body>
   </part>
   <part>
      <header name="Content-Description">Some descriptive text</header>
      <header name="Content-Type">text/plain; charset=utf-8</header>
      <body>Goodbye!
</body>
   </part>
   <part>
      <header name="Content-Description">Some descriptive text</header>
      <header name="Content-Type">application/xml; charset=utf-8</header>
      <body>
         <doc/>
      </body>
   </part>
</check-multipart>
</t:output>

</t:test>

