From 5a17e687298b3098b18adfaaea8575d4b188fa15 Mon Sep 17 00:00:00 2001 From: Zhou Fangyi Date: Tue, 6 Jun 2017 08:23:00 +0100 Subject: [PATCH] curl: add separate entry for header & HTTP method; clarify entry for JSON (#1396) --- pages/common/curl.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/common/curl.md b/pages/common/curl.md index 37bf3c1b9..4600a239c 100644 --- a/pages/common/curl.md +++ b/pages/common/curl.md @@ -19,9 +19,13 @@ `curl -d {{'name=bob'}} {{http://example.com/form}}` -- Send data, specifying a custom HTTP method, and including an extra header: +- Send a request with an extra header using a custom HTTP method: -`curl -d {{'{"name":"bob"}'}} -X {{PUT}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}}` +`curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{http://example.com}}` + +- Send data in JSON format, specifying the appropriate content-type header: + +`curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}}` - Pass a user name and password for server authentication and show headers info only: