curl will learn the command interface test

curl command

curl command

curl command is the most commonly used server-side debugging command interface, not one

  1. GET curl test interfaces
curl http://www.baidu.com

GET curl test interfaces

url parameter may be directly written to the url, url case preferably enclosed in quotes

curl 'http://115.28.108.130:5000/add/?a=1&b=2'

Test parameters get request curl

  1. Post request form class
    curl can -drequest data designated (contains -dparameter defaults to request Post), as
curl 'http://115.28.108.130:5000/api/user/login/'  \
-d 'name=张三&password=123456'

Post test request form classes curl

  1. Post request JSON format
    curl may be a -Hspecified header, a plurality of header to use a plurality of -H(
curl 'http://115.28.108.130:5000/api/user/reg/' \
-H 'Content-type: application/json' \
-d '{"name":"张三三","password": 123456}'

curl request to test JSON format Post

  1. Request with the Cookie
    Cookie belong to a header, we can carry to crawl to the Cookie request interface requires a login, such as:
curl 'http://115.28.108.130:5000/api/user/getUserList/' \
-H 'Cookie:PYSESSID=05eac6ba-2eb6-11e9-a130-00163e06e52c;session=eyIwNWVhYzZiYS0yZWI2LTExZTktYTEzMC0wMDE2M2UwNmU1MmMiOnRydWV9.D0Q51A.u9XjrAZb-plUSl01QnNPkGXJPck'

  1. You can use -vthe parameters to view the request details
    curl_05.png

  2. Other requests PUT / DELETE and the like may be used -Xto specify the request method
curl -X PUT 'http://.....'

Guess you like

Origin www.cnblogs.com/superhin/p/11454941.html