Documentation

Overview

Example
Output:

0) Request
Hail, Server!
1) Response
Hello, Client!

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(Origin, []byte, error)

    Callback is a callback method that is invoked during HTTP communications to forward captured data.

    type Origin

    type Origin uint

      Origin is an enumeration used to annotate which type of data is being fed to the callback.

      const (
      	Request Origin = iota
      	Response
      )

        Log transport types.

        func (Origin) String

        func (t Origin) String() string

          String converts a Origin to a user-friendly string.

          type Transport

          type Transport struct {
          	// Underlying RoundTripper; uses http.DefaultTransport if nil.
          	http.RoundTripper
          
          	Callback Callback // Output callback.
          }

            Transport is an implementation of http.RoundTripper that logs outgoing requests and incoming responses.

            func (*Transport) RoundTrip

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

              RoundTrip implements the http.RoundTripper interface.

              Source Files