File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -216,8 +216,7 @@ extern "C" fn start_task(
216216 check_webview_id_valid ( webview_id) ?;
217217 check_task_is_valid ( & webview, task_key, task_uuid. clone ( ) ) ?;
218218
219- let content = sent_response. body ( ) ;
220- let content_len = content. len ( ) ;
219+ let content_len = sent_response. body ( ) . len ( ) ;
221220 // default: application/octet-stream, but should be provided by the client
222221 let wanted_mime = sent_response. headers ( ) . get ( CONTENT_TYPE ) ;
223222 // default to 200
@@ -267,11 +266,12 @@ extern "C" fn start_task(
267266 } ) )
268267 . map_err ( |_e| crate :: Error :: CustomProtocolTaskInvalid ) ?;
269268
269+ let content = sent_response. into_body ( ) ;
270270 let data = if content_len < NO_COPY_DATA_THRESHOLD {
271271 // Keep small responses on the original copy path; no-copy deallocation costs more.
272- NSData :: with_bytes ( content)
272+ NSData :: with_bytes ( content. as_ref ( ) )
273273 } else {
274- match sent_response . into_body ( ) {
274+ match content {
275275 Cow :: Owned ( content) => NSData :: from_vec ( content) ,
276276 Cow :: Borrowed ( content) => {
277277 // Copy borrowed responses because NSData cannot take ownership.
You can’t perform that action at this time.
0 commit comments