Skip to content

Commit

Permalink
ci(rustman): Fix Rustman custom headers (#2813)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixincreate authored Nov 8, 2023
1 parent 8985794 commit e93f76b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions crates/test_utils/src/newman_runner.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::{
env,
fs::OpenOptions,
io::{self, Write},
path::Path,
process::Command,
};
use std::{env, io::Write, path::Path, process::Command};

use clap::{arg, command, Parser};
use masking::PeekInterface;
Expand Down Expand Up @@ -52,22 +46,22 @@ fn get_path(name: impl AsRef<str>) -> String {

// This function currently allows you to add only custom headers.
// In future, as we scale, this can be modified based on the need
fn insert_content<T, U>(dir: T, content_to_insert: U) -> io::Result<()>
fn insert_content<T, U>(dir: T, content_to_insert: U) -> std::io::Result<()>
where
T: AsRef<Path> + std::fmt::Debug,
U: AsRef<str> + std::fmt::Debug,
T: AsRef<Path>,
U: AsRef<str>,
{
let file_name = "event.prerequest.js";
let file_path = dir.as_ref().join(file_name);

// Open the file in write mode or create it if it doesn't exist
let mut file = OpenOptions::new()
let mut file = std::fs::OpenOptions::new()
.write(true)
.append(true)
.create(true)
.open(file_path)?;

write!(file, "\n{:#?}", content_to_insert)?;
write!(file, "{}", content_to_insert.as_ref())?;

Ok(())
}
Expand Down

0 comments on commit e93f76b

Please sign in to comment.