XProc 3:带有文件的表单数据

问题描述 投票:0回答:1
xproc
1个回答
0
投票

我不知道 MorganaXProc-IIIse 是否对表单数据施加任何限制,但 XProc 3.0 规范 要求 XProc 处理器处理多部分请求。如果

content-type
标头以
multipart/
开头,则会创建多部分请求。

此管道包含内容类型为

multipart/form-data
的 POST 请求。我使用 https://httpbin.org/post 进行测试。
<p:http-request/>
的更多示例可以在我的XProc 3.0教程中找到:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
      
  <p:input port="source" content-types="text/plain">
    <p:document href="input/deu.txt"/>
  </p:input>
      
  <p:output port="result"/>
    
  <p:option name="api-key" values="'123456'"/>
      
  <p:http-request name="http-request"
                  headers="map{
                    'content-type':'multipart/form-data',
                    'api-key': concat('Bearer ', $api-key)
                    }"
                  method="post"
                  href="https://httpbin.org/post">
  </p:http-request>

</p:declare-step>
© www.soinside.com 2019 - 2024. All rights reserved.