use fastly::http::{Method, StatusCode};
use fastly::{Error, Request, Response};

#[fastly::main]
fn main(req: Request) -> Result<Response, Error> {
    match (req.get_method(), req.get_path()) {
        (&Method::GET, "/robots.txt") => {
            Ok(Response::from_body("User-agent: BadBot\nDisallow: /\n"))
        }
        _ => Ok(
            Response::from_body("The page you requested could not be found")
                .with_status(StatusCode::NOT_FOUND),
        ),
    }
}