use fastly::Request;

fn main() {
    // Send request to backend and get one req_withoutbody for later use
    let req = Request::from_client();
    let req_withoutbody =req.clone_without_body();
    let mut backend_resp = req.send("origin_0").unwrap();

    // set cache control header if Fastly-FF header not present in the req
    if !req_withoutbody.contains_header("Fastly-FF") {
        backend_resp.set_header("Cache-Control","private, no-cache");
    }

    // Start sending the backend response to the client with a now-empty body
    let streambody = backend_resp.stream_to_client();
    // Finish the streaming body to close the client connection
    streambody.finish().unwrap();    
}