mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-26 12:32:06 +03:00
Add multipart form data params to json export
This commit is contained in:
parent
cf7a4f215d
commit
8fe2e3daf3
@ -101,6 +101,7 @@ impl Serialize for Request {
|
|||||||
state.serialize_field("queryString", &self.clone().querystring)?;
|
state.serialize_field("queryString", &self.clone().querystring)?;
|
||||||
state.serialize_field("headers", &self.clone().headers)?;
|
state.serialize_field("headers", &self.clone().headers)?;
|
||||||
state.serialize_field("cookies", &self.clone().cookies)?;
|
state.serialize_field("cookies", &self.clone().cookies)?;
|
||||||
|
state.serialize_field("multipartFormData", &self.clone().multipart)?;
|
||||||
|
|
||||||
if !self.clone().form.is_empty() {
|
if !self.clone().form.is_empty() {
|
||||||
state.serialize_field("form", &self.clone().form)?;
|
state.serialize_field("form", &self.clone().form)?;
|
||||||
@ -227,6 +228,34 @@ impl Serialize for Cookie {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Serialize for MultipartParam {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
match &self.clone() {
|
||||||
|
MultipartParam::Param(param) => param.serialize(serializer),
|
||||||
|
MultipartParam::FileParam(file_param) => file_param.serialize(serializer),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Serialize for FileParam {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
let mut state = serializer.serialize_struct("FileParam", 4)?;
|
||||||
|
state.serialize_field("name", &self.clone().name)?;
|
||||||
|
if let Ok(s) = std::str::from_utf8(&self.clone().data) {
|
||||||
|
state.serialize_field("value", s)?;
|
||||||
|
}
|
||||||
|
state.serialize_field("fileName", &self.clone().filename)?;
|
||||||
|
state.serialize_field("contentType", &self.clone().content_type)?;
|
||||||
|
state.end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Serialize for Value {
|
impl Serialize for Value {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user