mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-21 06:37:21 +00:00
Add debugging option for the request / response cycle.
This commit is contained in:
@@ -38,12 +38,14 @@ func proxyTheRequest(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
proxy.WithClient(cfg.Client.FastProxyClient)
|
proxy.WithClient(cfg.Client.FastProxyClient)
|
||||||
|
|
||||||
|
cfg.Logger.Debug("Proxying the request", map[string]interface{}{"path": c.Path(), "body": string(c.Request().Body())})
|
||||||
err := proxy.DoRedirects(c, cfg.Server.HostGraphQL+c.Path(), 3)
|
err := proxy.DoRedirects(c, cfg.Server.HostGraphQL+c.Path(), 3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cfg.Logger.Error("Can't proxy the request", map[string]interface{}{"error": err.Error()})
|
cfg.Logger.Error("Can't proxy the request", map[string]interface{}{"error": err.Error()})
|
||||||
cfg.Monitoring.Increment(libpack_monitoring.MetricsFailed, nil)
|
cfg.Monitoring.Increment(libpack_monitoring.MetricsFailed, nil)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
cfg.Logger.Debug("Received proxied response", map[string]interface{}{"path": c.Path(), "response_body": string(c.Response().Body()), "response_code": c.Response().StatusCode()})
|
||||||
|
|
||||||
c.Response().Header.Del(fiber.HeaderServer)
|
c.Response().Header.Del(fiber.HeaderServer)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user