如何在Http请求中的multiPart / form-data中编写布尔参数

问题描述 投票:3回答:1

内容类型:multipart / form-data;

在MultiPart /表格数据中我有类似的东西

“String header =' - '+ boundary +'\ nContent-Disposition:form-data; name =”file“; filename =”'+ file.name +'“; \ nContent-Type:application / octet-stream';” --AaB03x

我需要添加一个布尔参数non_svg = true如何将它传递给multipart / formData

示例:

Request   curl ‐F "firstName=Kris" \
                ‐F "[email protected];type=text/plain" \
                echo.httpkit.com
Response     {
    "method": "POST",
    ...
    "headers": {
        "content‐length": "697",
        "content‐type": "multipart/form‐data;
        boundary = ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐488327019409 ",
        ...
    },
    "body": "‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐488327019409\r\n
    Content‐ Disposition: form‐ data;
    name = \"firstName\"\r\n\r\n
    Kris\ r\ n‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 488327019409\ r\ n
    Content‐ Disposition: form‐ data;
    name = \"publicKey\";
    filename = \"id_rsa.pub\"\r\n
    Content‐ Type: text / plain\ r\ n\ r\ n‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 488327019409‐‐\ r\ n ",
        ...
}

------ 488327019409 ==>这是边界

http salesforce apex box
1个回答
0
投票

您无法使用multipart/form-data传递输入的参数。您可以改为将布尔参数字符串化并传递non_svg="true"

© www.soinside.com 2019 - 2024. All rights reserved.