Skip to content

Commit c77b71e

Browse files
committed
feat(develop): Add outgoing_request context
This should replace `event.request` on the client completely.
1 parent 5169e7f commit c77b71e

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
@@ -814,6 +814,55 @@ Page context contains information about the page that the event occurred on.
814814
}
815815
```
816816

817+
## Outgoing Request Context
818+
819+
Outgoing request context contains information about the outgoing request associated with the event.
820+
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.
821+
822+
`url`
823+
824+
: **Required.** The URL of the outgoing request.
825+
826+
- Example: `https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1`
827+
828+
`method`
829+
830+
: **Required.** The HTTP method of the outgoing request.
831+
832+
- Example: `GET`
833+
834+
`headers`
835+
836+
: **Optional.** The headers of the outgoing request.
837+
838+
- Example: `{ "Content-Type": "application/json" }`
839+
840+
`data`
841+
842+
: **Optional.** The data of the outgoing request.
843+
844+
- Example: `{ "name": "John Doe", "email": "[email protected]" }`
845+
846+
### Example Outgoing Request Context
847+
848+
```json
849+
{
850+
"contexts": {
851+
"outgoing_request": {
852+
"url": "https://sentry.io/api/0/projects/sentry/sentry/issues/?page=1",
853+
"method": "GET",
854+
"headers": {
855+
"Content-Type": "application/json"
856+
},
857+
"data": {
858+
"name": "John Doe",
859+
"email": "[email protected]"
860+
}
861+
}
862+
}
863+
}
864+
```
865+
817866
## Response Context
818867

819868
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)