// Copyright (c) 2026, Salesforce, Inc.,
// All rights reserved.
// For full license text, see the LICENSE.txt file
use crate::UnitHttpResponse;
use regex::Regex;
use std::thread::LocalKey;

pub fn matches<'a, const N: usize>(
    key: &'static LocalKey<Regex>,
    other: &'a str,
) -> Option<[&'a str; N]> {
    key.with(|re| re.captures(other).map(|c| c.extract().1))
}

pub fn not_found() -> UnitHttpResponse {
    UnitHttpResponse::new(404)
}
