local

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

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

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.

Jump to

Keyboard shortcuts

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