use hyper::{HeaderMap, StatusCode};
use std::collections::HashMap;
use crate::{response_handler::ResponseHandler, types::BoxBody};
pub fn status_code_response(
status_code: &StatusCode,
headers: Option<&HashMap<String, Option<String>>>,
request_headers: &HeaderMap,
cors_allow_credentials_origins: &[String],
) -> Result<hyper::Response<BoxBody>, hyper::http::Error> {
ResponseHandler::default()
.with_status(status_code)
.with_custom_headers(headers)
.into_response(request_headers, cors_allow_credentials_origins)
}
pub fn status_code_response_with_message(
status_code: &StatusCode,
message: &str,
headers: Option<&HashMap<String, Option<String>>>,
request_headers: &HeaderMap,
cors_allow_credentials_origins: &[String],
) -> Result<hyper::Response<BoxBody>, hyper::http::Error> {
ResponseHandler::default()
.with_status(status_code)
.with_text(message, None)
.with_custom_headers(headers)
.into_response(request_headers, cors_allow_credentials_origins)
}