Help us shape the future of Go! Take the 2026 Go Developer Survey

curl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package curl implements the `curl` built-in.

This is NOT a real curl(1); it is a thin wrapper around the network.Doer plumbed through Context.Fetch. All HTTP/HTTPS traffic goes through that Doer — the curl built-in itself never touches the network stack. When Context.Fetch is nil (host did not configure BashOptions.Network or BashOptions.Fetch), curl emits the "network disabled" diagnostic and exits with code 2.

Supported flags:

-X METHOD               request method
-H 'K: V'               extra header (repeatable)
-d DATA                 request body (URL-encoded by default)
--data-binary DATA      request body verbatim
--data-urlencode DATA   request body, URL-encoded
-F NAME=VALUE           multipart/form-data field (repeatable)
-o FILE                 write body to FILE (use - for stdout)
-O                      write body to the URL's basename
-s, --silent            no progress / no error output
-S, --show-error        re-enable error output when used with -s
-L, --location          follow redirects (Doer policy decides)
-i, --include           include response headers in the output
-I, --head              issue a HEAD request, print headers only
-k, --insecure          permit TLS errors (no-op; Doer governs)
-u USER:PASS            HTTP Basic auth
-A AGENT                User-Agent header
-e REFERER              Referer header
-f, --fail              exit 22 on HTTP >= 400 without body output
--max-time DUR          per-request time cap (seconds, optional unit)
-w FORMAT               write-out format string (subset)
-G                      issue a GET, append -d data as the query string
--help                  show this help and exit

`-w` placeholders implemented: %{http_code}, %{size_download}, %{url_effective}, %{content_type}, %{response_code} (alias), %{num_headers}, and literal \n / \t escapes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() command.Command

New returns the curl command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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