go-curl

module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2023 License: MIT

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
}


Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL