dataCollection docs example uses wrong shape for httpHeaders

Open Beginner friendly
#18,685 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Domain
documentation

Research direction

Open the linked sendDefaultPii deprecation section and compare its httpHeaders example with the DataCollection type in @sentry/core@10.64.0. Update the example to use the nested request and response forms, then verify that cookies and queryParams remain unchanged and the documentation example matches the type.

Written by the indexing model from the issue text.

Description

documentation Good First Issue

The code example in the sendDefaultPii deprecation section shows httpHeaders as a flat CollectBehavior value:

httpHeaders: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },

But the actual DataCollection TypeScript type (verified in @sentry/core@10.64.0) defines httpHeaders as a nested per-direction object:

httpHeaders?: {
  request?: CollectBehavior;
  response?: CollectBehavior;
};

Passing { deny: [...] } directly causes a TypeScript error because deny is not a valid key on { request?, response? }.

Workaround — use the nested form:

httpHeaders: {
  request: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
  response: { deny: ["forwarded", "-ip", "remote-", "via", "-user"] },
},

cookies and queryParams use CollectBehavior directly and are correct in the example. Only httpHeaders is wrong.

--

View Junior Session in Sentry

Dominant language
MDX
Stars
446
Forks
1.7k
Avg merge
1d 21h
Merged PRs (30d)
312

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-docs

All issues in getsentry/sentry-docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.