api: github.com/moov-io/api/cmd/apitest/local Index | Files

package local

import "github.com/moov-io/api/cmd/apitest/local"

Index

Package Files

transport.go

type Transport Uses

type Transport struct {
    Underlying http.RoundTripper

    Debug bool
}

Transport intercepts HTTP requests and re-writes them according to bind.HTTP's local port binds. This is done to provide an shared http.RoundTripper usable by clients wishing for local dev with Moov.

The underlying http.RoundTripper is required to enforce timeouts and other config be non-default and so we don't hack into http.DefaultClient (which has no timeouts).

func (*Transport) RoundTrip Uses

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

RoundTrip modifies the incoming request to reshape a Moov API production URL to a local dev URL. The GoDoc for http.RoundTripper state that the request SHOULD not be modified, not MUST. If this ends up causing problems we'll have to figure out another solution.

This means:

- Dropping /v1/$app routing prefix
- Changing the local port used (each app runs on its own port now)
  - Adjusting the scheme if needed.

Package local imports 5 packages (graph) and is imported by 2 packages. Updated 2019-04-21. Refresh now. Tools for package owners.