Skip to content

Commit

Permalink
chore: add some debug logs + fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jun 11, 2024
1 parent 788d952 commit 37d6546
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rust/pact_matching/src/form_urlencoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use itertools::Itertools;
use pact_models::bodies::OptionalBody;
use pact_models::http_parts::HttpPart;
use tracing::debug;

use crate::{MatchingContext, Mismatch};
use crate::query::match_query_maps;
Expand Down Expand Up @@ -53,6 +54,7 @@ pub(crate) fn match_form_urlencoded(
(Err(m), Ok(_)) => Err(vec![m]),
(Ok(_), Err(m2)) => Err(vec![m2]),
(Ok(e), Ok(a)) => {
debug!(expected=?e, actual=?a, "Comparing form post body");
let expected_params = super::group_by(e, |(k, _)| k.clone())
.iter()
.map(|(k, v)| (k.clone(), v.iter().map(|(_, v)| Some(v.clone())).collect_vec()))
Expand Down
2 changes: 1 addition & 1 deletion rust/pact_models/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn strip_comments(mut line: String) -> String {
}

fn main() -> io::Result<()> {
let parser = LineParser::new();
let parser = LineParser::default();
let mut table = TableBuilder::new();

for entry in fs::read_dir(Path::new("tzdata"))? {
Expand Down
7 changes: 7 additions & 0 deletions rust/pact_models/src/content_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,13 @@ mod tests {
sub_type: "xml".into(),
.. ContentType::default()
}));

let content_type = ContentType::parse("application/x-www-form-urlencoded").unwrap();
expect!(content_type.base_type()).to(be_equal_to(ContentType {
main_type: "application".into(),
sub_type: "x-www-form-urlencoded".into(),
.. ContentType::default()
}));
}

#[test]
Expand Down

0 comments on commit 37d6546

Please sign in to comment.