Skip to content

0x726f6f6b6965/go-curl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

a repository for converting requests between curl and http

Resources

License

Stars

Watchers

Forks

Packages

No packages published