単なる個人的なcURLの使い方メモです。
参考サイト
レスポンスヘッダーの出力 (-D)
出力先を標準出力にしたい場合は、出力先を「-」にすればOK。
$ curl -D - http://localhost:8080/
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
Date: Sun, 22 May 2016 04:22:33 GMT
Welcome !!
リダイレクト先へのアクセス (-L)
$ curl -L -D - http://localhost:8080/redirect
HTTP/1.1 302 Found
Server: Apache-Coyote/1.1
Location: http://localhost:8080/
Content-Language: ja-JP
Content-Length: 0
Date: Sun, 22 May 2016 04:28:51 GMT
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
Date: Sun, 22 May 2016 04:28:51 GMT
Welcome !!
HEADリクエスト(-I)
$ curl -I http://localhost:8080/todos
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 2
Date: Sun, 29 May 2016 10:10:58 GMT
OPTIONSリクエスト(-X OPTIONS)
curl -D - -X OPTIONS http://localhost:8080/todos
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Allow: POST,GET,HEAD
Content-Length: 0
Date: Sun, 29 May 2016 14:46:12 GMT