curl

package
v0.0.0-...-6ce207b Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command represents an invocation of the curl executable. For example: >Curl -X POST https://127.0.0.1/test

Becomes: CurlCommand{
   options: [ curlOption{flag: "-X", value: "POST"} ]
   args: ["https://127.0.0.1/test"]
}.

func InitCurlCommand

func InitCurlCommand(options ...Config) *Command

InitCurlCommand creates a new CurlCommand with the specified configs applied.

func (*Command) Run

func (c *Command) Run() error

Run runs the CurlCommand with stdin, stdout, and stderr piped through to the parent process.

type Config

type Config func(*Command)

Config allows to configure the CurlCommand.

func Args

func Args(args []string) Config

Args allows custom strings as arguments to the curl call.

func BearerToken

func BearerToken(token string) Config

BearerToken sets the "authorization:" header.

func Header(name, value string) Config

Header sets adds a header to the curl call.

func Method

func Method(method string) Config

Method sets the http method for the curl invocation.

func Url

func Url(url *url.URL) Config

Url defines the url curl calls.

Jump to

Keyboard shortcuts

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