curl

package
v0.0.0-...-ea9f171 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(cli *http.Client, req *http.Request) string

Format formats the given HTTP request as a curl command.

This will include all headers, and also the request body if GetBody is set. Notes:

* Header names are quoted using fmt.Sprintf, so it may not always be correct for shell quoting. * The URL is only quoted and not escaped, so URLs with single quotes will not currently work.

The client parameter is optional and is used to find cookies from the cookie jar.

Types

type Parsed

type Parsed struct {
	*http.Request
	ParsedJSON map[string]any
}

func Parse

func Parse(curl string) (*Parsed, error)

Jump to

Keyboard shortcuts

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