🖥
#curl で -X POST オプションを指定しなくても POST になる場合 ( Note: Unnecessary use of -X
-d ( --data ) や --request をつけた場合は勝手に POST になるみたいだ。
重複指定すると教えてくれる。
$ curl -X POST -v "https://httpbin.org/post" -H "accept: application/json" -d "XXX"
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 34.193.212.251...
* TCP_NODELAY set
* Connected to httpbin.org (34.193.212.251) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=httpbin.org
* start date: Feb 17 00:00:00 2019 GMT
* expire date: Mar 17 12:00:00 2020 GMT
* subjectAltName: host "httpbin.org" matched cert's "httpbin.org"
* issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
* SSL certificate verify ok.
> POST /post HTTP/1.1
> Host: httpbin.org
> User-Agent: curl/7.64.1
> accept: application/json
> Content-Length: 3
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 3 out of 3 bytes
< HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: *
< Content-Type: application/json
< Date: Sun, 01 Dec 2019 23:00:21 GMT
< Referrer-Policy: no-referrer-when-downgrade
< Server: nginx
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< Content-Length: 382
< Connection: keep-alive
<
{
"args": {},
"data": "",
"files": {},
"form": {
"XXX": ""
},
"headers": {
"Accept": "application/json",
"Content-Length": "3",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "curl/7.64.1"
},
"json": null,
"origin": "218.224.69.65, 218.224.69.65",
"url": "https://httpbin.org/post"
}
* Connection #0 to host httpbin.org left intact
* Closing connection 0
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
公開日時
2019-12-03
Discussion