TreeviewCopyright © aleen42 all right reserved, powered by aleen42

curl

POST

默认是application/x-www-form-urlencoded 对于表单提交

curl -d "param1=value1&param2=value2" -X POST http://localhost:3000/data

等效于

curl -d "param1=value1&param2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data

如果是jsont提交则是

curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:3000/data

如果是json文件也是可以的

curl -d "@data.json" -X POST http://localhost:3000/data

data.json内容如下
{
  "key1":"value1",
  "key2":"value2"
}

上传文件

curl -F "uploadfile=@C:\Users\wangs\Desktop\xueba_license.txt" localhost:8080/upload

results matching ""

    No results matching ""