Skip to content

Complete support for multipart/form-data HTTP API tests #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-03 09:24:13.740178",
"spec_repo_commit": "5906d277"
"regenerated": "2025-06-04 09:15:00.755608",
"spec_repo_commit": "5e0396ec"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-03 09:24:13.756322",
"spec_repo_commit": "5906d277"
"regenerated": "2025-06-04 09:15:00.771870",
"spec_repo_commit": "5e0396ec"
}
}
}
10 changes: 9 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17166,13 +17166,21 @@ components:
description: DNS server port to use for DNS tests.
type: string
files:
description: Files to be used as part of the request in the test.
description: Files to be used as part of the request in the test. Only valid
if `bodyType` is `multipart/form-data`.
items:
$ref: '#/components/schemas/SyntheticsTestRequestBodyFile'
type: array
follow_redirects:
description: Specifies whether or not the request follows redirects.
type: boolean
form:
additionalProperties:
description: A single form entry.
type: string
description: Form to be used as part of the request in the test. Only valid
if `bodyType` is `multipart/form-data`.
type: object
headers:
$ref: '#/components/schemas/SyntheticsTestHeaders'
host:
Expand Down
19 changes: 18 additions & 1 deletion src/datadogV1/model/model_synthetics_test_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ pub struct SyntheticsTestRequest {
/// DNS server port to use for DNS tests.
#[serde(rename = "dnsServerPort")]
pub dns_server_port: Option<String>,
/// Files to be used as part of the request in the test.
/// Files to be used as part of the request in the test. Only valid if `bodyType` is `multipart/form-data`.
#[serde(rename = "files")]
pub files: Option<Vec<crate::datadogV1::model::SyntheticsTestRequestBodyFile>>,
/// Specifies whether or not the request follows redirects.
#[serde(rename = "follow_redirects")]
pub follow_redirects: Option<bool>,
/// Form to be used as part of the request in the test. Only valid if `bodyType` is `multipart/form-data`.
#[serde(rename = "form")]
pub form: Option<std::collections::BTreeMap<String, String>>,
/// Headers to include when performing the test.
#[serde(rename = "headers")]
pub headers: Option<std::collections::BTreeMap<String, String>>,
Expand Down Expand Up @@ -126,6 +129,7 @@ impl SyntheticsTestRequest {
dns_server_port: None,
files: None,
follow_redirects: None,
form: None,
headers: None,
host: None,
http_version: None,
Expand Down Expand Up @@ -222,6 +226,11 @@ impl SyntheticsTestRequest {
self
}

pub fn form(mut self, value: std::collections::BTreeMap<String, String>) -> Self {
self.form = Some(value);
self
}

pub fn headers(mut self, value: std::collections::BTreeMap<String, String>) -> Self {
self.headers = Some(value);
self
Expand Down Expand Up @@ -359,6 +368,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequest {
let mut files: Option<Vec<crate::datadogV1::model::SyntheticsTestRequestBodyFile>> =
None;
let mut follow_redirects: Option<bool> = None;
let mut form: Option<std::collections::BTreeMap<String, String>> = None;
let mut headers: Option<std::collections::BTreeMap<String, String>> = None;
let mut host: Option<String> = None;
let mut http_version: Option<
Expand Down Expand Up @@ -495,6 +505,12 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequest {
follow_redirects =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"form" => {
if v.is_null() {
continue;
}
form = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"headers" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -640,6 +656,7 @@ impl<'de> Deserialize<'de> for SyntheticsTestRequest {
dns_server_port,
files,
follow_redirects,
form,
headers,
host,
http_version,
Expand Down
Loading