Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions content/en/synthetics/api_tests/http_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

{{% tab "Privacy" %}}

* **Do not save response body**: Select this option to prevent response body from being saved at runtime. This can be helpful to ensure no sensitive data gets featured in your test results. Use mindfully as it can make failures troubleshooting more difficult. For more security recommendations, see [Synthetic Monitoring Security][1].
* **Do not save response body**: Select this option to prevent the response body from being saved at runtime and to truncate the error message of failed JavaScript assertions. This helps ensure no sensitive data is displayed in your test results, but it can make failure troubleshooting more difficult. For full security recommendations, see [Synthetic Monitoring Data Security][1].

Check warning on line 128 in content/en/synthetics/api_tests/http_tests.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.words_case_insensitive

Use 'helps' or 'helps ensure' instead of 'ensure'.


[1]: /data_security/synthetics
Expand Down Expand Up @@ -182,12 +182,19 @@

Use JavaScript assertions when standard response assertions don't meet your validation needs. Synthetic Monitoring uses the [Chai assertion library][20], which provides `dd.expect()`, `dd.should`, and `dd.assert()` for flexible assertion styles.

**Note:** When working with JSON responses, use `JSON.parse(dd.response.body)` to parse the response body before accessing its properties. This is required for all assertion methods (`dd.assert()`, `dd.expect()`, and `dd.should`) when validating JSON data.
When working with JSON responses, use `JSON.parse(dd.response.body)` to parse the response body before accessing its properties. This is required for all assertion methods (`dd.assert()`, `dd.expect()`, and `dd.should`) when validating JSON data.

{{< img src="synthetics/api_tests/JS_assertion.png" alt="JavaScript assertion for HTTP API test" style="width:90%;" >}}

<div class="alert alert-info">JavaScript capabilities are not supported for API tests in Windows private locations.</div>

<div class="alert alert-info">
<ul>
<li>JavaScript capabilities are not supported for API tests in Windows private locations.</li>
<li>If a failed JavaScript assertion's error message might include sensitive data, under <strong>Advanced Options</strong> > <strong>Privacy</strong>, enable <strong>Do not save response body</strong>. This truncates the assertion error message.</li>
</ul>
</div>

#### Using dd.assert()

Use `dd.assert()` for traditional assertion syntax:
Expand Down
Loading