Name

p:http-request — The standard p:http-request step.

Synopsis

The p:http-request step allows authors to interact with resources over HTTP or related protocols. Implementations must support the http and https protocols.

Input portPrimarySequenceContent types
source✔ ✔ any 
Output portPrimarySequenceContent types
result✔ ✔ any 
report  application/json 
Option nameTypeDefault valueRequired
hrefxs:anyURI ✔ 
assertxs:string'.?status-code lt 400' 
authmap(xs:string, item()+)?() 
headersmap(xs:string, xs:string)?() 
methodxs:string?'GET' 
parametersmap(xs:QName, item()*)?() 
serializationmap(xs:QName,item()*)?() 
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:input port="source" content-types="any" sequence="true"/>
   |   <p:output port="result"
   |             primary="true"
 5 |             content-types="any"
   |             sequence="true"/>
   |   <p:output port="report" content-types="application/json"/>
   |   <p:option name="href" as="xs:anyURI" required="true"/>
   |   <p:option name="method" as="xs:string?" select="'GET'"/>
10 |   <p:option name="serialization" as="map(xs:QName,item()*)?"/>
   |   <p:option name="headers" as="map(xs:string, xs:string)?"/>
   |   <p:option name="auth" as="map(xs:string, item()+)?"/>
   |   <p:option name="parameters" as="map(xs:QName, item()*)?"/>
   |   <p:option name="assert" as="xs:string" select="'.?status-code lt 400'"/>
15 |</p:declare-step>
Errors
CodeDescription
err:XC0003It is a dynamic error (err:XC0003) if a “username” or a “password” key is present without specifying a value for the “auth-method” key, if the requested auth-method isn't supported, or the authentication challenge contains an authentication method that isn't supported.
err:XC0030It is a dynamic error (err:XC0030) if the response body cannot be interpreted as requested (e.g. application/json to override application/xml content).
err:XC0078It is a dynamic error (err:XC0078) if the value associated with the “fail-on-timeout” is associated with true() and a HTTP status code 408 is encountered.
err:XC0122It is a dynamic error (err:XC0122) if the given method is not supported.
err:XC0123It is a dynamic error (err:XC0123) if any key in the “auth” map is associated with a value that is not an instance of the required type.
err:XC0124It is a dynamic error (err:XC0124) if any key in the “parameters” map is associated with a value that is not an instance of the required type.
err:XC0125It is a dynamic error (err:XC0125) if the key “accept-multipart” as the value false() and a multipart response is detected.
err:XC0126It is a dynamic error (err:XC0126) if the XPath expression in assert evaluates to false.
err:XC0127It is a dynamic error (err:XC0127) if the headers map contains two keys that are the same when compared in a case-insensitive manner.
err:XC0128It is a dynamic error (err:XC0128) if the URI’s scheme is unknown or not supported.
err:XC0131It is a dynamic error (err:XC0131) if the processor cannot support the requested encoding.
err:XC0132It is a dynamic error (err:XC0132) if the override content encoding cannot be supported.
err:XC0133It is a dynamic error (err:XC0133) if more than one document appears on the source port and a content-type header is present and the content type specified is not a multipart content type.
err:XC0203It is a dynamic error (err:XC0203) if the specified boundary is not valid (for example, if it begins with two hyphens “--”).
err:XD0079It is a dynamic error (err:XD0079) if a supplied content-type is not a valid media type of the form “type/subtype+ext” or “type/subtype”.
Implementation defined features

Description

The p:http-request step is defined in the XProc 3.0: Standard Step Library. It is also described on XProcRef.org.