通过 curl 测试 REST POST api 时,是否可以从外部 json 文件发送数据,而不是通过 --data
内联?
最佳答案
要指定文件中的数据,请使用 --data @filename。从 curl 的手册页:
If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with --data @foobar.
关于json - 可以使用 curl 上传外部 json 文件而不是 --data 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10427616/