
Package autorest implements an http request pipeline suitable for use across multiple go-routines and provides the shared routines relied on by autorest (see https://github.com/azure/autorest/) generated go code.
the package breaks sending and responding to http requests into three phases: preparing, sending, and responding.
each phase relies on decorators to modify and / or manage processing. decorators may first modify and then pass the data along, pass the data first and then modify the result, or wrap themselves around passing the data (such as a logger might do). decorators run in the order provided.
preparers and responders may be shared and re-used (assuming the underlying decorators support sharing and re-use). performant use is obtained by creating one or more preparers and responders shared among multiple go-routines, and a single sender shared among multiple sending go-routines, all bound together by means of input / output channels.
decorators hold their passed state within a closure (such as the path components in the example above). be careful to share preparers and responders only in a context where such held state applies. for example, it may not make sense to share a preparer that applies a query string from a fixed set of values. similarly, sharing a responder that reads the response body into a passed struct (e.g., byunmarshallingjson) is likely incorrect.
lastly, the swagger specification (https://swagger.io) that drives autorest (https://github.com/azure/autorest/) precisely defines two date forms: date and date-time. the github.com/azure/go-autorest/autorest/date package provides time.time derivations to ensure correct parsing and formatting.
errors raised by autorest objects and methods will conform to the autorest.error interface.