Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurlCommand ¶
type CurlCommand struct {
// contains filtered or unexported fields
}
CurlCommand contains exec.Command compatible slice + helpers
func GetCurlCommand ¶
func GetCurlCommand(req *http.Request) (*CurlCommand, error)
GetCurlCommand returns a CurlCommand corresponding to an http.Request
Example ¶
req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", bytes.NewBufferString(`{"hello":"world","answer":42}`)) req.Header.Set("Content-Type", "application/json") command, _ := GetCurlCommand(req) fmt.Println(command)
Output: curl -X PUT -d "{\"hello\":\"world\",\"answer\":42}" -H "Content-Type: application/json" http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu
func (*CurlCommand) String ¶
func (c *CurlCommand) String() string
String returns a ready to copy/paste command
Click to show internal directories.
Click to hide internal directories.