MCPcopy Create free account
hub / github.com/buggregator/server / processPayload

Method processPayload

modules/vardumper/handler.go:42–79  ·  view source on GitHub ↗
(base64Payload string)

Source from the content-addressed store, hash-verified

40}
41
42func (h *tcpHandler) processPayload(base64Payload string) {
43 result, err := h.php.Parse(base64Payload)
44 if err != nil {
45 slog.Error("vardumper: parse error", "err", err)
46 return
47 }
48
49 // Build event payload matching the PHP Buggregator format.
50 payload := map[string]any{
51 "payload": map[string]any{
52 "type": result.Type,
53 "value": result.Value,
54 "label": result.Label,
55 },
56 "context": json.RawMessage(result.Context),
57 }
58
59 if result.Language != nil {
60 payload["payload"].(map[string]any)["language"] = *result.Language
61 }
62
63 b, _ := json.Marshal(payload)
64
65 project := ""
66 if result.Project != nil {
67 project = *result.Project
68 }
69
70 inc := &event.Incoming{
71 Type: "var-dump",
72 Payload: json.RawMessage(b),
73 Project: project,
74 }
75
76 if err := h.eventService.HandleIncoming(context.Background(), inc); err != nil {
77 slog.Error("vardumper: failed to store event", "err", err)
78 }
79}

Callers 1

HandleConnectionMethod · 0.95

Calls 2

ParseMethod · 0.80
HandleIncomingMethod · 0.65

Tested by

no test coverage detected