httpdebugtransport

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

README

go-httpdebugtransport

Go Reference

Go utility to debug HTTP requests/response, with support for authenication

Usage


    import (
        github.com/ArcticSnowman/go-httpdebugtransport
    )

    ct := httpdebugtransport.New()  
    ct.SetToken("some-token")
    ct.SetDebug(true)
  
  	client := http.Client{
		Transport: ct.Client(),
		Timeout:   4 * time.Second,
	}

    client.Get(url)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugAuthTransport

type DebugAuthTransport struct {
	Username string
	Password string
	Token    string
	Debug    bool

	Transport http.RoundTripper
}

func New

func New() *DebugAuthTransport

New DebugAuthTransport

func (*DebugAuthTransport) Client

func (t *DebugAuthTransport) Client() *http.Client

Returns http client with transport

func (*DebugAuthTransport) RoundTrip

func (t *DebugAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

func (*DebugAuthTransport) SetCredentails

func (t *DebugAuthTransport) SetCredentails(username string, password string)

SetCredentails - Set username/password for basic authentication

func (*DebugAuthTransport) SetDebug

func (t *DebugAuthTransport) SetDebug(debug bool)

SetDebug - Enable debug output

func (*DebugAuthTransport) SetToken

func (t *DebugAuthTransport) SetToken(token string)

SetToken - Set Authorization header in request.

Jump to

Keyboard shortcuts

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