negroni v0.3.0 Release Notes
Release Date: 2017-11-11 // over 6 years ago-
➕ Added
- 🏗
With()
helper for building a newNegroni
struct chaining handlers from
existingNegroni
structs - 🔧 Format log output in
Logger
middleware via a configurabletext/template
0️⃣ string injectable via.SetFormat
. AddedLoggerDefaultFormat
and
🔧LoggerDefaultDateFormat
to configure the default template and date format
👉 used by theLogger
middleware. - 👌 Support for HTTP/2 pusher support via
http.Pusher
interface for Go 1.8+. WrapFunc
to converthttp.HandlerFunc
into anegroni.Handler
- 🔧
Formatter
field added toRecovery
middleware to allow configuring how
0️⃣panic
s are output. Default ofTextFormatter
(how it was output in
0.2.0
) used.HTMLPanicFormatter
also added to allow easy outputing of
panic
s as HTML.
🛠 Fixed
Written()
correct returnsfalse
if no response header has been written- Only implement
http.CloseNotifier
with thenegroni.ResponseWriter
if the
underlyinghttp.ResponseWriter
implements it (previously would always
implement it and panic if the underlyinghttp.ResponseWriter
did not.
🔄 Changed
- 0️⃣ Set default status to
0
in the case that no handler writes status -- was
previously200
(in 0.2.0, before that it was0
so this reestablishes that
behavior) - Catch
panic
s thrown by callbacks provided to theRecovery
handler - Recovery middleware will set
text/plain
content-type if none is set ALogger
interface to allow custom logger outputs to be used with the
Logger
middleware. Changes embeded field innegroni.Logger
fromLogger
toALogger
.- 0️⃣ Default
Logger
middleware output changed to be more structure and verbose
👀 (also now configurable, seeAdded
) - Automatically bind to port specified in
$PORT
in.Run()
if an address is
not passed in. Fall back to binding to:8080
if no address specified
0️⃣ (configuable viaDefaultAddress
). - ✨
PanicHandlerFunc
added toRecovery
middleware to enhance custom handling
ofpanic
s by providing additional information to the handler including the
stack and thehttp.Request
.Recovery.ErrorHandlerFunc
was also added, but
🗄 deprecated in favor of the newPanicHandlerFunc
.
- 🏗