curl -X DELETE "https://myhost/context/path/users/$(echo -ne "OXYugGKg207g5uN/07V" | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g')"
curl -X DELETE 'http://localhost:5000/locations?id=3'
curl -i -b auth -H "" -X POST
curl http://localhost:5000/todos/todo2 -X DELETE -v
我一般是用curl命令进行测试,除此之外,还可以使用Chrome浏览器的postman扩展。
https://gold.xitu.io/entry/5754ec05816dfa005f7bc01b
选项 作用
-X 指定HTTP请求方法,如POST,GET
-H 指定请求头,例如Content-type:application/json
-d 指定请求数据
--data-binary 指定发送的文件
-i 显示响应头部信息
-u 指定认证用户名与密码
-v 输出请求头部信息
http://www.voidcn.com/blog/Qidi_Huang/article/p-6136742.html
http://usench.iteye.com/blog/2268844
http://www.linuxdiyf.com/linux/2800.html
http://www.ruanyifeng.com/blog/2011/09/curl.html
http://stormzhang.com/devtools/2014/11/07/use-curl-debug/
http://stackoverflow.com/questions/13371284/curl-command-line-url-parameters
curl -X DELETE -G 'http://localhost:5000/locations' -d 'id=3'
curl -X DELETE -G \
'http://localhost:5000/locations' \
-d id=3 \
-d name=Mario \
-d surname=Bros
https://github.com/micha/resty
source resty [-W] [remote] # load functions into shell
resty [-v] # prints current request URI base
resty <remote> [OPTIONS] # sets the base request URI
HEAD [path] [OPTIONS] # HEAD request
OPTIONS [path] [OPTIONS] # OPTIONS request
GET [path] [OPTIONS] # GET request
DELETE [path] [OPTIONS] # DELETE request
PUT [path] [data] [OPTIONS] # PUT request
PATCH [path] [data] [OPTIONS] # PATCH request
POST [path] [data] [OPTIONS] # POST request
TRACE [path] [OPTIONS] # TRACE request
Options:
-Q Don't URL encode the path.
-q <query> Send query string with the path. A '?' is prepended to
<query> and concatenated onto the <path>.
-W Don't write to history file (only when sourcing script).
-V Edit the input data interactively in 'vi'. (PUT, PATCH,
and POST requests only, with data piped to stdin.)
-Z Raw output. This disables any processing of HTML in the
response.
-v Verbose output. When used with the resty command itself
this prints the saved curl options along with the current
URI base. Otherwise this is passed to curl for verbose
curl output.
--dry-run Just output the curl command.
<curl opt> Any curl options will be passed down to curl.

本文介绍了Curl命令的基本用法及各种选项的作用,包括如何指定HTTP请求方法、请求头、请求数据等。此外还展示了如何使用Curl进行DELETE操作,并提到了Postman作为另一种测试工具。
133

被折叠的 条评论
为什么被折叠?



