mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:38:50 +02:00
refactor: fix incorrect logic introduced in previous commits and improve error handling
This commit is contained in:
@@ -170,6 +170,13 @@ func (m *Middleware) ModifyRequest(next http.HandlerFunc, w http.ResponseWriter,
|
||||
next(w, r)
|
||||
}
|
||||
|
||||
func (m *Middleware) TryModifyRequest(w http.ResponseWriter, r *http.Request) (proceed bool) {
|
||||
if exec, ok := m.impl.(RequestModifier); ok {
|
||||
return exec.before(w, r)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *Middleware) ModifyResponse(resp *http.Response) error {
|
||||
if exec, ok := m.impl.(ResponseModifier); ok {
|
||||
return exec.modifyResponse(resp)
|
||||
|
||||
Reference in New Issue
Block a user