Skip to content

Releases: gol4ng/httpware

v2.3.1

31 Jan 10:59
7947cd4
Compare
Choose a tag to compare

implement enable middleware/tripperware

v2.3.0

29 Jan 07:13
c7e09db
Compare
Choose a tag to compare

⚠️ [BC] Signature change

// <= 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

21 Jan 11:26
4c7d3ea
Compare
Choose a tag to compare

add skip middleware/tripperware

v2.1.1

02 Dec 15:10
7e3da1f
Compare
Choose a tag to compare
  • set response writer interceptor status code to OK by default

v2.1.0

19 Nov 08:53
Compare
Choose a tag to compare
  • add interceptor middleware/tripperware

v2.0.2

04 Nov 11:13
5d1c519
Compare
Choose a tag to compare

[Fix] According to go mod

v2.0.0

04 Nov 10:08
Compare
Choose a tag to compare

Usage of option pattern to simplify middleware/tripperware instanciation

v1.0.0

30 Oct 15:21
Compare
Choose a tag to compare

⚠️ 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

11 Oct 08:22
ae8a6b4
Compare
Choose a tag to compare
  • rename request-id in correlation-id
  • fixup tripperware correlation from req.context

v0.3.0

09 Sep 08:28
8c72a6d
Compare
Choose a tag to compare
tripperware act as round tripper with default transport (#11)