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

Function TestHandler_NumericProject_Envelope

modules/sentry/handler_test.go:267–286  ·  view source on GitHub ↗

TestHandler_NumericProject_Envelope routes a numeric DSN envelope to the default project (empty project) — the JS SDK path of issue #338.

(t *testing.T)

Source from the content-addressed store, hash-verified

265// TestHandler_NumericProject_Envelope routes a numeric DSN envelope to the
266// default project (empty project) — the JS SDK path of issue #338.
267func TestHandler_NumericProject_Envelope(t *testing.T) {
268 h := &handler{}
269
270 body := `{"event_id":"env-1"}
271{"type":"event"}
272{"event_id":"env-1","level":"error","exception":{"values":[{"type":"E","value":"v"}]}}`
273 r := httptest.NewRequest("POST", "/api/1/envelope/", strings.NewReader(body))
274 r.Header.Set("X-Sentry-Auth", "Sentry sentry_key=test")
275
276 inc, err := h.Handle(r)
277 if err != nil {
278 t.Fatalf("Handle() error: %v", err)
279 }
280 if inc == nil {
281 t.Fatal("Handle() returned nil, want non-nil incoming event")
282 }
283 if inc.Project != "" {
284 t.Errorf("Project = %q, want %q (routes to default)", inc.Project, "")
285 }
286}
287
288// TestHandler_SDKv3_PlainJSON tests Sentry PHP SDK v3 without tracing.
289// v3 sends plain JSON to /api/{project}/store with event_id in payload.

Callers

nothing calls this directly

Calls 1

HandleMethod · 0.95

Tested by

no test coverage detected