From e8aa08ef663de331c88ac0ad9c596d23f9c3a98e Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 4 Nov 2024 13:20:31 +0500 Subject: [PATCH] Dont swallow error --- ntex/CHANGES.md | 2 ++ ntex/src/web/scope.rs | 2 +- ntex/src/web/test.rs | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ntex/CHANGES.md b/ntex/CHANGES.md index f27f4afe..a1f89ac7 100644 --- a/ntex/CHANGES.md +++ b/ntex/CHANGES.md @@ -4,6 +4,8 @@ * Use updated Service trait +* Don't swallow error when calling panic for read_response_json #443 + ## [2.7.0] - 2024-10-16 * Better handling for h2 remote payload diff --git a/ntex/src/web/scope.rs b/ntex/src/web/scope.rs index f514bcbf..6e462cec 100644 --- a/ntex/src/web/scope.rs +++ b/ntex/src/web/scope.rs @@ -5,7 +5,7 @@ use crate::router::{IntoPattern, ResourceDef, Router}; use crate::service::boxed::{self, BoxService, BoxServiceFactory}; use crate::service::{chain_factory, dev::ServiceChainFactory, IntoServiceFactory}; use crate::service::{Identity, Middleware, Service, ServiceCtx, ServiceFactory}; -use crate::util::{join, Extensions}; +use crate::util::{join, select, Extensions}; use super::app::Filter; use super::config::ServiceConfig; diff --git a/ntex/src/web/test.rs b/ntex/src/web/test.rs index d561dff1..20c65fd0 100644 --- a/ntex/src/web/test.rs +++ b/ntex/src/web/test.rs @@ -244,8 +244,9 @@ where { let body = read_response::(app, req).await; - serde_json::from_slice(&body) - .unwrap_or_else(|_| panic!("read_response_json failed during deserialization")) + serde_json::from_slice(&body).unwrap_or_else(|e| { + panic!("read_response_json failed during deserialization, {:?}", e) + }) } /// Helper method for extractors testing