簡體   English   中英

如何使用 cURL 發布請求將文件內容作為數據原始負載中的字符串發送

[英]How to send file content as string in data raw payload using cURL post request

下面是我發送 post 請求的 curl 查詢

在 json 數據的“有效負載”鍵中,我需要發送 1 MB 文本數據作為值的文件。 而不是將整個文本作為字符串復制過去,這應該將文本作為來自我驅動器中本地保存文件的字符串。

curl --location --request POST 'http://localhost:8080/test' \
--header 'Content-Type: application/json' \
--data-raw '{
            "fileFormat":"csv",
            "version":"v1",
            "payload":"<local file content should come here>",

} 

將您的數據負載放入文件並嘗試使用: curl --location --request POST 'http://localhost:8080/test' \\ --header 'Content-Type: application/json' \\ --d @/path/to/filename.json 希望這能解決你的問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM