将带有POST / PUT / PATCH请求的有效载荷数据发送到Sentry.io

时间:2019-07-04 07:59:32

标签: angular sentry

我正在尝试将有效载荷数据添加到发送到Sentry.io的面包屑中。

它看起来像这样。

enter image description here

我发现了如何添加响应。

const sentryConfig: BrowserOptions = {
  beforeBreadcrumb: (breadcrumb, hint) => {
    if (breadcrumb.category === 'xhr') {
      // hint.xhr is a whole XHR object that you can use to modify breadcrumb
      breadcrumb.data = (hint.xhr as XMLHttpRequest).response;
    }

    return breadcrumb;
  }
};

但是我似乎找不到增加有效载荷的方法。 XMLHttpRequest没有此信息。

1 个答案:

答案 0 :(得分:1)

我认为没有办法从xhr请求中获取有效载荷。创建xhr请求时,无论您在何处拥有有效负载,我都只会pointerEvents="none"。它不会属于同一面包屑,但您会在Sentry中看到它。

相关问题