use helix_core::effect::HttpRequest;
use helix_core::port_codec::http_result_to_outcome;
use helix_core::ports::HttpRequester;
use helix_core::tick::PortOutcome;
pub use helix_core::port_codec::base64_encode;
pub async fn run_http_envelope<H>(http: &H, req: HttpRequest) -> PortOutcome
where
H: HttpRequester + ?Sized,
{
http_result_to_outcome(http.request(req).await)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_base64_encode() {
assert_eq!(base64_encode(b"Man"), "TWFu");
assert_eq!(base64_encode(b"Ma"), "TWE=");
assert_eq!(base64_encode(b"M"), "TQ==");
assert_eq!(base64_encode(b""), "");
}
}