Categorygithub.com/0x726f6f6b6965/go-curl
repository
0.0.2
Repository: https://github.com/0x726f6f6b6965/go-curl.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

go-curl

GoDoc Go Report Card codecov


a repository for converting requests between curl and http

Example


httpReq, err := http.NewRequest(http.MethodGET, "https://example.com/", nil)

if err != nil {
    // Process error what you like
}

curlReq, err := NewCurlRequestWithContext(context.Background(), httpReq)

if err != nil {
    // Process error what you like
}


// if inscure is true, the command will add `-k`
err = curlReq.GenerateCommand(true)

if err != nil {
    // Process error what you like
}

// This can get the curl command
command := curlReq.GetCommands()

// This can run the curl command and get the http response

resp, err := curlReq.Do()

if err != nil {
    // Process error what you like
}