Web Requests Profiler module reference
Use the Web Requests Profiler module to inspect the HTTP requests your application sends.
Read time 9 minutesLast updated 7 hours 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. The module doesn't record requests that sends through any other message handler. 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 |
|---|---|
| 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 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. |
Request 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