Only follow the first follow-redirect
redirections.
Test nw-http-request-131.xml is expected to pass.
It requires the following features: p:http-request.
<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 method="get" href="http://localhost:8246/service/this-is-a" parameters="map{'follow-redirect': 2}">
<p:with-input>
<p:empty/>
</p:with-input>
</p:http-request>
<p:identity>
<p:with-input pipe="report"/>
</p:identity>
<p:identity name="status">
<p:with-input>
<code>{.?status-code}</code>
<base-uri>{.?base-uri}</base-uri>
<location>{.?headers?location}</location>
</p:with-input>
</p:identity>
<p:wrap-sequence wrapper="wrap"/>
</p:declare-step>
<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::wrap">The root is not wrap.</s:assert>
<s:assert test="base-uri = 'http://localhost:8246/service/this-is-c'">The base-uri is incorrect.</s:assert>
<s:assert test="code = 302">The status-code is incorrect.</s:assert>
<s:assert test="location = 'http://localhost:8246/service/this-is-d'">The redirect location is incorrect.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Reworked the test. A redirect no longer returns a document, so there’s no base URI. Instead, the test assumes the base URI will be in the map produced on the report port.
Test that follow-redirect works as advertised.