0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cURLのメモ

0
Last updated at Posted at 2016-05-22

単なる個人的な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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?