GoCurl is a command-line HTTP client tool inspired by curl, implemented in Go. It provides functionality for making HTTP requests with various methods, handling custom headers, supporting SSL/TLS, and managing file uploads and downloads.
- Support for different HTTP methods (GET, POST, PUT, DELETE, etc.)
- Custom header support
- JSON output formatting
- SSL/TLS support
- File upload functionality
- File download functionality
- Verbose output mode
To build GoCurl from source:
git clone https://github.com/user/gocurl.git
cd gocurl
go build -o gocurl ./cmd/gocurl
./gocurl https://example.com
./gocurl -X POST https://example.com
./gocurl -X PUT https://example.com
./gocurl -X DELETE https://example.com
./gocurl -H "Content-Type: application/json" -H "Authorization: Bearer token" https://example.com
./gocurl -X POST -d '{"key":"value"}' https://example.com
./gocurl --json https://api.example.com
./gocurl -k https://self-signed.example.com
./gocurl -v https://example.com
./gocurl -o response.txt https://example.com
./gocurl -F "file=@/path/to/file.txt" https://upload.example.com
./gocurl -F "file=@/path/to/file.txt" -form "name=value" https://upload.example.com
-F string
Upload file (format: fieldname=@filename)
-H string
Headers to include (can be used multiple times)
-X string
HTTP method to use (default "GET")
-d string
Data to send in the request body
-form string
Add form field (format: name=value)
-json
Format output as JSON
-k
Allow insecure SSL connections
-o string
Write output to file instead of stdout
-v
Enable verbose output
gocurl/
├── cmd/
│ └── gocurl/ # Main application entry point
│ └── main.go # Main function and CLI handling
├── pkg/
│ ├── http/ # HTTP request handling
│ │ ├── client.go # HTTP client implementation
│ │ ├── request.go # Request building
│ │ └── response.go # Response handling
│ ├── output/ # Output formatting
│ │ ├── formatter.go # Output formatter interface
│ │ └── json.go # JSON output implementation
│ └── file/ # File operations
│ ├── upload.go # File upload functionality
│ └── download.go # File download functionality
└── go.mod # Go module definition