aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/http/curl_response.rs
blob: 3c4f9231cf0a4da3d5723905780ddc85bacdd570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! ref: composer/src/Composer/Util/Http/CurlResponse.php

use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;

use super::response::Response;

#[derive(Debug)]
pub struct CurlResponse {
    pub(crate) inner: Response,
    curl_info: IndexMap<String, PhpMixed>,
}

impl CurlResponse {
    pub fn new(
        request: IndexMap<String, PhpMixed>,
        code: Option<i64>,
        headers: Vec<String>,
        body: Option<String>,
        curl_info: IndexMap<String, PhpMixed>,
    ) -> Self {
        Self {
            inner: Response::new(request, code, headers, body),
            curl_info,
        }
    }

    pub fn get_curl_info(&self) -> &IndexMap<String, PhpMixed> {
        &self.curl_info
    }
}