Skip to content

Commit 889e1c1

Browse files
committed
feat(develop): Add outgoing_request context
This should replace `event.request` on the client completely.
1 parent 66f2ca8 commit 889e1c1

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

develop-docs/sdk/data-model/event-payloads/contexts.mdx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,55 @@ Page context contains information about the page that the event occurred on.
828828
}
829829
```
830830

831+
## Outgoing Request Context
832+
833+
Outgoing request context contains information about the outgoing request associated with the event.
834+
It should only be set for events that are associated with an outgoing request - for example, a `failed to fetch` error on a web page.
835+
836+
`url`
837+
838+
: **Required.** The URL of the outgoing request.
839+
840+
- Example: `https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1`
841+
842+
`method`
843+
844+
: **Required.** The HTTP method of the outgoing request.
845+
846+
- Example: `GET`
847+
848+
`headers`
849+
850+
: **Optional.** The headers of the outgoing request.
851+
852+
- Example: `{ "Content-Type": "application/json" }`
853+
854+
`data`
855+
856+
: **Optional.** The data of the outgoing request.
857+
858+
- Example: `{ "name": "John Doe", "email": "[email protected]" }`
859+
860+
### Example Outgoing Request Context
861+
862+
```json
863+
{
864+
"contexts": {
865+
"outgoing_request": {
866+
"url": "https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1",
867+
"method": "GET",
868+
"headers": {
869+
"Content-Type": "application/json"
870+
},
871+
"data": {
872+
"name": "John Doe",
873+
"email": "[email protected]"
874+
}
875+
}
876+
}
877+
}
878+
```
879+
831880
## Response Context
832881

833882
Response context contains information about the HTTP response associated with the event.

develop-docs/sdk/data-model/event-payloads/request.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ title: Request Interface
33
sidebar_order: 8
44
---
55

6-
The Request interface contains information on a HTTP request related to the
7-
event. In client SDKs, this can be an outgoing request (use the [page context](../contexts/#page-context) to track the page that the request was made from).
8-
On server SDKs, this could be the incoming web request that is being handled.
6+
The Request interface contains information on an incoming HTTP request related to the
7+
event. For outgoing requests, use the [outgoing request context](../contexts/#outgoing-request-context).
8+
9+
In client SDKs, use the [page context](../contexts/#page-context) instead.
910

1011
The data variable should only contain the request body (not the query string).
1112
It can either be a dictionary (for standard HTTP requests) or a raw request

0 commit comments

Comments
 (0)