httpdsak

package
v0.0.0-...-64b0400 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(uri string, opts ...Option) (*Client, error)

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run runs the HTTP request.

type Option

type Option func(*Client) error

Option is a function that configures a Client.

func WithAccept

func WithAccept(v string) Option

WithAccept configures the request accept header value.

func WithBody

func WithBody(b io.ReadCloser) Option

WithBody configures the request body.

func WithContentType

func WithContentType(v string) Option

WithContentType configures the request content-type header value.

func WithForceHTTP1

func WithForceHTTP1() Option

WithForceHTTP1 set client to force using HTTP/1.1.

func WithForceHTTP2

func WithForceHTTP2() Option

WithForceHTTP2 set client to force using HTTP/2.

func WithForceType

func WithForceType(t string) Option

WithForceType tells client to force using given content-type for response.

func WithHeader

func WithHeader(name, value string) Option

WithHeader adds an header to request.

func WithInsecure

func WithInsecure() Option

func WithJQ

func WithJQ(filter string) Option

WithJQ configures the jq query to filter a JSON response.

func WithLog

func WithLog(writer io.Writer) Option

WithLog configures the client log writer.

func WithMethod

func WithMethod(method string) Option

WithMethod configures the method to use while doing the request.

func WithOut

func WithOut(writer io.Writer) Option

WithOut configures the client output writer.

func WithRaw

func WithRaw() Option

WithRaw tells client to output the raw response body.

func WithStyle

func WithStyle(style string) Option

WithStyle tells client to use the given style while highlighting response body.

func WithTrace

func WithTrace() Option

WithTrace tells client to show a tracing log of the request execution.

Jump to

Keyboard shortcuts

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