curl

package module
v0.0.0-...-ea548b3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 11 Imported by: 0

README ¶

Curl HTTP Transport for Go's http.Client

Implements an http.RoundTripper for Go's http.Client that uses your local curl binary to execute the request.

Usage

rt := curl.Transport{}
hc := http.Client{Transport: &rt}
rs, _ := hc.Get("https://en.wikipedia.org/")

Why!?

Mostly to see if it could be done. No real reason beyond that.

Expectation Management

This is an experiment. No API stability guarantees are made and the code is not guaranteed to work.

I recommend you copy-paste pieces you want to use as-needed (including tests and license/attribution) into the internal/ folder of your projects rather than reference these modules directly as I may change the APIs in here without warning at any time.

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

This section is empty.

Types ¶

type HTTPVersion ¶

type HTTPVersion string
const (
	HTTP10              HTTPVersion = "--http1.0"
	HTTP11              HTTPVersion = "--http1.1"
	HTTP2               HTTPVersion = "--http2"
	HTTP2PriorKnowledge HTTPVersion = "--http2-prior-knowledge"
	HTTP3               HTTPVersion = "--http3"
)

type Network ¶

type Network string
const (
	NetIPv4 Network = "--ipv4"
	NetIPv6 Network = "--ipv6"
)

type Transport ¶

type Transport struct {
	CurlBin            string
	Version            HTTPVersion
	Insecure           bool
	Network            Network
	DisableCompression bool
}

func (*Transport) RoundTrip ¶

func (rt *Transport) RoundTrip(rq *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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