From 303a1c4127c580146544f0bbb7c43b25ea56bc39 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Tue, 3 May 2022 17:03:24 +0530 Subject: [PATCH] fix(ext/http): panic on Response.error() --- ext/http/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/http/lib.rs b/ext/http/lib.rs index 28689654e6..1d5c512dbc 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -506,7 +506,9 @@ async fn op_http_write_headers( let mut etag_header = None; let mut content_type_header = None; - builder.headers_mut().unwrap().reserve(headers.len()); + if let Some(h) = builder.headers_mut() { + h.reserve(headers.len()) + }; for (key, value) in &headers { if key.eq_ignore_ascii_case(b"cache-control") { if let Ok(value) = std::str::from_utf8(value) {