diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 19:47:36 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 19:47:36 +0900 |
| commit | af4b9fcba1206e3fcc97fc243ffc674f85547942 (patch) | |
| tree | 7066e219d80024150919316af900c666957a64fb /crates/shirabe/src/util/http/curl_response.rs | |
| parent | d9090c4c52fa29ee1569aedf8be858bf78001d7b (diff) | |
| download | php-shirabe-af4b9fcba1206e3fcc97fc243ffc674f85547942.tar.gz php-shirabe-af4b9fcba1206e3fcc97fc243ffc674f85547942.tar.zst php-shirabe-af4b9fcba1206e3fcc97fc243ffc674f85547942.zip | |
refactor(http-response): take url directly instead of request map
Response only ever reads the url out of the request array, so accept it
as a String directly. With url always present the 'url key missing'
LogicException can no longer fire, so Response::new and CurlResponse::new
return Self instead of a double Result. Also drops the unused
from_php_mixed/to_php_mixed stubs and the request_to_map helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/http/curl_response.rs')
| -rw-r--r-- | crates/shirabe/src/util/http/curl_response.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/shirabe/src/util/http/curl_response.rs b/crates/shirabe/src/util/http/curl_response.rs index 9f330b6..cc3d21b 100644 --- a/crates/shirabe/src/util/http/curl_response.rs +++ b/crates/shirabe/src/util/http/curl_response.rs @@ -13,16 +13,14 @@ pub struct CurlResponse { impl CurlResponse { pub fn new( - request: IndexMap<String, PhpMixed>, + url: String, code: Option<i64>, headers: Vec<String>, body: Option<String>, curl_info: IndexMap<String, PhpMixed>, - ) -> anyhow::Result<Result<Self, shirabe_php_shim::LogicException>> { - match Response::new(request, code, headers, body)? { - Ok(inner) => Ok(Ok(Self { inner, curl_info })), - Err(e) => Ok(Err(e)), - } + ) -> Self { + let inner = Response::new(url, code, headers, body); + Self { inner, curl_info } } pub fn get_curl_info(&self) -> &IndexMap<String, PhpMixed> { |
