Releases: gol4ng/httpware
Releases · gol4ng/httpware
v2.3.1
implement enable middleware/tripperware
v2.3.0
// <= v2.2.0
func (m Middlewares) Append(middleware ...Middleware) Middlewares {}
func (m Middlewares) Prepend(middleware ...Middleware) Middlewares {}
func (t Tripperwares) Append(tripperwares ...Tripperware) Tripperwares {}
func (t Tripperwares) Prepend(tripperwares ...Tripperware) Tripperwares {}
// >= v2.3.0 Pointer receiver
func (m *Middlewares) Append(middleware ...Middleware) Middlewares {}
func (m *Middlewares) Prepend(middleware ...Middleware) Middlewares {}
func (t *Tripperwares) Append(tripperwares ...Tripperware) Tripperwares {}
func (t *Tripperwares) Prepend(tripperwares ...Tripperware) Tripperwares {}
Implement some helper method
func (m Middleware) AppendIf(condition bool, middlewares ...Middleware) Middlewares {}
func (m Middleware) PrependIf(condition bool, middlewares ...Middleware) Middlewares {}
func (m *Middlewares) AppendIf(condition bool, middlewares ...Middleware) Middlewares {}
func (m *Middlewares) PrependIf(condition bool, middlewares ...Middleware) Middlewares {}
func (t Tripperware) AppendIf(condition bool, tripperwares ...Tripperware) Tripperwares {}
func (t Tripperware) PrependIf(condition bool, tripperwares ...Tripperware) Tripperwares {}
func (t *Tripperwares) AppendIf(condition bool, tripperwares ...Tripperware) Tripperwares {}
func (t *Tripperwares) PrependIf(condition bool, tripperwares ...Tripperware) Tripperwares {}
v2.2.0
add skip middleware/tripperware
v2.1.1
- set response writer interceptor status code to OK by default
v2.1.0
- add interceptor middleware/tripperware
v2.0.2
[Fix] According to go mod
v2.0.0
Usage of option pattern to simplify middleware/tripperware instanciation
v1.0.0
⚠️ This release contains a Breaking change regarding v0.x ⚠️
Change
invert the stack computation:
middleware
[t1, t2, t3, t4].DecorateHandler(<yourHandler>) == t4(t3(t2(t1(<yourHandler>))))
becomes
[t1, t2, t3, t4].DecorateHandler(<yourHandler>) == t1(t2(t3(t4(<yourHandler>))))
tripperware
[t1, t2, t3, t4].DecorateRoundTripper(<yourTripper>) == t4(t3(t2(t1(<yourTripper>))))
become
[t1, t2, t3, t4].DecorateRoundTripper(<yourTripper>) == t1(t2(t3(t4(<yourTripper>))))
Migration note
In order to correctly update version you must invert all your stack order
Example:
stack := httpware.TripperwareStack(
MyTripperwareA,
MyTripperwareB,
)
stack.Append(
MyTripperwareC,
MyTripperwareD,
)
// MyTripperwareD(MyTripperwareC(MyTripperwareB(MyTripperwareA(<yourtripper>))))
becomes
stack := httpware.TripperwareStack(
MyTripperwareB,
MyTripperwareA,
)
stack.Prepend(
MyTripperwareD,
MyTripperwareC,
)
// MyTripperwareD(MyTripperwareC(MyTripperwareB(MyTripperwareA(<yourtripper>))))
v0.4.0
- rename request-id in correlation-id
- fixup tripperware correlation from req.context
v0.3.0
tripperware act as round tripper with default transport (#11)