Web Requests Profiler module reference
Use the Web Requests Profiler module to inspect the HTTP requests your application sends.
Read time 13 minutesLast updated 2 days ago
The Web Requests Profiler module displays information about the HTTP requests your application sends through . This includes requests that sends when it uses as its message handler. With the CoreCLR scripting backend, the module also records requests that sends through its default message handler, with fewer details. For more information, refer to Recorded data by request type. The module charts how many requests are in flight and how many bytes they send and receive each frame. It also lists every request in the capture with its status, size, and duration. Use this module to find slow or failing requests, check what your application sends to a server, and check what the server sends back.
UnityWebRequestSystem.Net.Http.HttpClientUnityHttpMessageHandlerHttpClientThis module is active by default. To show or hide it, refer to Activating Profiler modules. The module records a request only if the Profiler is recording when the request starts. Unity records the details of each request, such as its headers, bodies, and timings, when the request finishes. If you stop recording or deactivate the module while a request is in flight, the request list still displays the request, but as an incomplete request without its details.
Chart categories
The upper half of the Profiler window displays a Web Requests chart with the following categories:
Chart | Description |
|---|---|
| Active Requests | The number of requests in flight during this frame. |
| Bytes Down | The number of bytes your application received from requests during this frame. |
| Bytes Up | The number of bytes your application sent in requests during this frame. |
The module also registers the Requests Started, Requests Completed, Requests Failed, and Requests Dropped counters in the Web Requests Profiler category. The chart doesn't display these counters, but you can read them from a script with while the module is active.
ProfilerRecorderModule details pane toolbar
When you select the Web Requests module, the module details pane displays the requests that Unity recorded during the capture. Use the toolbar to access the following functionality:
Property | Description |
|---|---|
| Export | Saves the listed requests as a HAR file. For more information, refer to Export requests to a HAR file. |
| Search field | Filters the request list by URL, method, status code, content type, or request source. |
| Details panel toggle | Shows or hides the details panel for the selected request. |
Summary bar
The summary bar displays totals for all requests in the capture. Filtering the request list doesn't change these totals. The summary bar contains the following items:
Property | Description |
|---|---|
| Requests | The number of requests in the capture. When you filter the list, the item displays the number of visible requests out of the total. If the Profiler doesn't record some requests, the item also displays the number of dropped requests. For more information, refer to Request limits. |
| Completed | The number of requests that finished. |
| Transferred | The total number of bytes sent and received. If some requests ran on a platform that doesn't count transferred bytes, the value starts with ≥ to indicate that it's a lower bound. |
| Pending Requests | The number of requests still in flight. |
| Latency p95 | The duration within which 95% of the finished requests complete. This value doesn't include requests that are still in flight. |
| Errors | The number of requests that failed or that finished with an HTTP status code of 400 or higher. |
| Total Bytes Down/Up | The total number of bytes received and sent, as separate values. |
Request list
The request list displays one row for each request in the capture, in the order the requests started. To sort the list, select a column header. To sort by more than one column, hold Shift and select additional column headers.
When you select a request, the Profiler window jumps to the frame in which that request finished. The details panel, on the right side of the module details pane, displays information about the selected request.
The request list contains the following columns:
Column | Description |
|---|---|
| # | The order in which the requests started. |
| Status | The HTTP status code of the response. The column displays ... while the request is in flight, and - if the request finished without a status code. The color of the status code indicates whether the request succeeded, finished with a warning, or failed. Hover over the status code to display its description. |
| Method | The HTTP method of the request, such as |
| Name/Target Domain | The URL of the request. A warning icon appears next to URLs that use plain HTTP to a server other than the local machine, to indicate that Unity doesn't encrypt the request or the response. |
| Request Source | The API that sent the request: UnityWebRequest, or .NET HttpClient for requests that |
| Type | The content type of the response. |
| Size | The number of bytes received. The column displays — if the platform or message handler doesn't count transferred bytes. |
| Duration | The time from the start of the request until it finished. |
Context menu
Right-click (macOS: Ctrl+click) a request to open a menu with the following options:
Option | Description |
|---|---|
| Copy URL | Copies the URL of the request to the clipboard. |
| Copy Details | Copies a summary of the request to the clipboard, including its method, URL, status, source, content type, transferred bytes, and duration. |
Details panel
The details panel displays information about the selected request in the following tabs:
Unity records request and response bodies only if their content type is text, such as , JSON, XML, JavaScript, or URL-encoded form data (). Unity records up to 16 KB of each body. If a body is longer, the Payload and Response body tabs display the size of the recorded part and the size of the full body. If Unity doesn't record a body, the tab explains why.
text/*application/x-www-form-urlencodedIf a body has a JSON content type, the tab displays it as an expandable tree. The Payload and Response body tabs have the following buttons:
Button | Description |
|---|---|
| View Source | Displays the raw text of the query string or body. Select View Parsed to return to the tree or parameter list. |
| Copy | Copies the raw text of the query string or body to the clipboard. |
Headers tab
The Headers tab contains the following sections:
Section | Description |
|---|---|
| General | The Request URL, Request Method, Status Code, Request Source, Content Type, Transferred bytes, and Duration of the request. |
| Response Headers | The headers the server sent in its response. |
| Request Headers (Configured) | The headers your code set on the request. |
| Request Headers (Wire) | The headers that Unity sent to the server, including headers that Unity adds itself, such as a generated |
A warning icon appears next to headers whose values are credentials. For more information, refer to Safeguard sensitive data.
Payload tab
The Payload tab appears only when the request has a query string or a request body. It contains the following sections:
Section | Description |
|---|---|
| Query String Parameters | The name and value of each parameter in the query string of the URL. |
| Request Payload | The body your application sent with the request. |
Response body tab
The Response body tab displays the body that the server sent in its response.
Timing tab
The Timing tab displays how long each phase of the request took, in milliseconds, as a waterfall chart. If a phase doesn't occur, the tab displays Skipped for that phase. For example, a plain HTTP connection has no Transport Layer Security (TLS) handshake, and a reused connection has no Domain Name System (DNS) lookup. Not all platforms measure the duration of each phase. If the platform doesn't measure phase durations, the tab displays a message instead.
The Timing tab contains the following phases:
Phase | Description |
|---|---|
| Queueing | The time the request waited before the transfer started. |
| DNS Lookup | The time taken to resolve the host name of the server. |
| Initial Connection | The time taken to open a connection to the server. |
| TLS | The time taken to complete the TLS handshake for a secure connection. |
| Request sent | The time taken to prepare and send the request. |
| Waiting for server response | The time between sending the request and receiving the first byte of the response. |
| Content Download | The time taken to receive the rest of the response. |
| Total Time | The total duration of the request. |
Export requests to a HAR file
You can save requests in the request list as a HAR (HTTP Archive) file and open the file in the developer tools of a web browser or in a HAR viewer.
To export requests:
- In the module details pane toolbar, select Export.
- Select Save as HAR... or Save as HAR (include sensitive data)....
- Choose a name and location for the file.
The saved HAR file contains all requests visible in the list. If you enter text in the search field, the HAR file contains only the requests that match your search term. The Export menu is unavailable when the list is empty.
The two menu items differ in how they treat credentials:
- Save as HAR... removes the ,
Cookie,Set-Cookie, andAuthorizationheaders from the file.Proxy-Authorization - Save as HAR (include sensitive data)... keeps these headers. Unity asks you to confirm first, because anyone who has the file can use the cookies and authorization headers to act as you.
Neither item removes URLs, query strings, or request and response bodies. These can contain sensitive data such as access tokens or passwords. Review the file before you share it. For more information, refer to Safeguard sensitive data.
Recorded data by request type
How much the module records depends on the API that sends the request. Requests that sends, including requests that use , go through the Unity transport, which reports most details. For requests that use any other message handler, the module reads the diagnostics data that .NET publishes, which contains less.
UnityWebRequestHttpClientUnityHttpMessageHandlerHttpClientData |
|
|
|
|---|---|---|---|
| URL, method, status code, and duration | Yes | Yes | Yes. In some cases the query string displays as |
| Payload tab: Query String Parameters | Yes | Yes | Yes, when the module records the full URL. |
| Headers tab: Request Headers (Configured) | Yes | Yes | Yes, including the headers in |
| Headers tab: Request Headers (Wire) | Yes¹ | Yes¹ | No |
| Headers tab: Response Headers | Yes | Yes | No |
| Type column (response content type) | Yes | Yes | No |
| Size column and transferred bytes | Yes¹ | Yes¹ | No. The column displays —. |
| Payload tab: Request Payload, and Response body tab | Yes¹ | Yes¹ | No |
| Timing tab phases | Yes¹ | Yes¹ | No. The tab displays only the total duration. |
| Recorded in Development builds | Yes | Yes | Only with the CoreCLR scripting backend. |
¹ Not all platforms support this data.
HttpClient requests without UnityHttpMessageHandler
With the CoreCLR scripting backend, in the Unity Editor and in Development builds, the module records requests that sends through its default message handler, or through any message handler other than . For the data the module records for these requests, refer to Recorded data by request type. These requests also behave as follows:
HttpClientUnityHttpMessageHandler- If other code in your project also listens to activities, for example the OpenTelemetry SDK, or if the request starts while an
HttpClientis already running, .NET doesn't pass the full URL to the Profiler. In that case, the module displays the query string asActivity, for example*.https://example.com/items?* - Where the module has no data for these requests, such as response headers, bodies, and timing phases, the Headers, Payload, Response body, and Timing tabs say so and suggest .
UnityHttpMessageHandler - The Request Headers (Configured) section lists the headers as your code set them, before .NET sends the request. Headers that .NET adds when it sends the request, such as , aren't included.
Host - The Transferred item in the summary bar displays a lower bound when the capture contains these requests, because .NET doesn't report transferred bytes.
- If follows a redirect, the request list displays one row for each request in the redirect chain.
HttpClient
While the Profiler records, .NET adds a header to every request that sends through these message handlers. The Profiler doesn't cause .NET to add this header when it isn't recording or when the Web Requests module is inactive.
traceparentHttpClientTo record all details of requests, or to record them with other scripting backends, use as the message handler. You set the message handler when you create the , so this applies only to instances that your code creates. Requests from packages or other code you can't change keep the level of detail that this section describes.
HttpClientUnityHttpMessageHandlerHttpClientHttpClientRequest limits
The Profiler tracks up to 1,024 requests in flight at the same time. If your application starts more requests while 1,024 are in flight, the Profiler doesn't record them. The Requests item in the summary bar displays the number of dropped requests.
The request list displays up to 2,048 requests. When a capture contains more requests, the list removes the oldest ones, but the summary bar still includes them in its totals.
Safeguard sensitive data
The Web Requests module records the requests your application sends and the responses it receives. This data can include sensitive information, such as passwords, access tokens, and personal data. Unity stores this data in plain text in the Profiler capture, and anyone who has a copy of a saved capture can read it.
Unity records request data only in the Unity Editor and in Development builds, while the Profiler is recording and the Web Requests module is active. A capture can contain the following data for each request:
- The full URL, including the query string. Some web services expect API keys or access tokens in the query string.
- The request headers your code sets, the request headers Unity sends, and the response headers. These can include headers and cookies.
Authorization - Up to 16 KB of each text request body and response body. For example, the body of a login request can contain a user name and password, and the body of its response can contain an access token.
The module displays a warning icon next to the , , , and headers. The module doesn't detect sensitive data anywhere else, such as in custom headers, query strings, or bodies. A request without a warning icon can still contain sensitive data.
AuthorizationProxy-AuthorizationCookieSet-CookieTo reduce the risk of exposing sensitive data:
- Deactivate the Web Requests module when you don't need it, and always before you record a capture to share with others. For more information, refer to Activating Profiler modules.
- Use test accounts, test credentials, and test servers when you profile your application.
- Treat any capture you record while the Web Requests module is active as sensitive. Don't attach it to bug reports or post it in public forums unless you know it contains no real credentials or personal data.
- Exclude the folder from version control, or change the save location in Profiler Preferences. By default, Unity saves captures to the
ProfilerCapturesfolder of your project, so anyone with access to your project can open them.ProfilerCaptures