@@ -30,18 +30,26 @@ var postCmd = &cobra.Command{
3030 Long : `Make a POST request to the specified URL with optional data and headers.
3131
3232Supports random data generation using templates with placeholders:
33- {{name}} - Random full name
34- {{firstname}} - Random first name
35- {{lastname}} - Random last name
36- {{email}} - Random email address
37- {{phone}} - Random phone number
38- {{number}} - Random number (1-100)
39- {{number:1:50}} - Random number with range
40- {{text}} - Random paragraph
41- {{sentence}} - Random sentence
42- {{uuid}} - Random UUID
43- {{bool}} - Random boolean
44- {{date}} - Random date` ,
33+ {{name}} - Random full name
34+ {{firstname}} - Random first name
35+ {{lastname}} - Random last name
36+ {{email}} - Random email address
37+ {{phone}} - Random phone number
38+ {{number}} - Random number (1-100)
39+ {{number:1:50}} - Random number with range
40+ {{float}} - Random float (0-100, 2 decimals)
41+ {{float:1:50:3}} - Random float with range and decimal places
42+ {{price}} - Random price ending in .99 (1-100)
43+ {{price:5:50}} - Random price with range
44+ {{text}} - Random paragraph
45+ {{sentence}} - Random sentence
46+ {{uuid}} - Random UUID
47+ {{bool}} - Random boolean
48+ {{date}} - Random date
49+
50+ Note: For numeric JSON fields, don't wrap placeholders in quotes:
51+ ✓ "price": {{price}}
52+ ✗ "price": "{{price}}"` ,
4553 Args : cobra .ExactArgs (1 ),
4654 Run : func (cmd * cobra.Command , args []string ) {
4755 url := args [0 ]
@@ -108,9 +116,7 @@ Supports random data generation using templates with placeholders:
108116 os .Exit (1 )
109117 }
110118
111- if postContentType != "" {
112- req .Header .Set ("Content-Type" , postContentType )
113- }
119+ req .Header .Set ("Content-Type" , postContentType )
114120
115121 for _ , header := range postHeaders {
116122 parts := strings .SplitN (header , ":" , 2 )
0 commit comments