Bugzilla – Attachment 184324 Details for
Bug 40173
Reuse http-client from Cypress tests - preparation steps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40173: Return the response early if the caller needs it
Bug-40173-Return-the-response-early-if-the-caller-.patch (text/plain), 1.74 KB, created by
Martin Renvoize (ashimema)
on 2025-07-18 11:00:26 UTC
(
hide
)
Description:
Bug 40173: Return the response early if the caller needs it
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-18 11:00:26 UTC
Size:
1.74 KB
patch
obsolete
>From 9238246d4c0d160bb914fc5021bb0685bfb102f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Jun 2025 11:10:32 +0200 >Subject: [PATCH] Bug 40173: Return the response early if the caller needs it > >We returned the response too late: if something was wrong we processed >the response already and thrown an error. > >This may introduce side-effects but it feels like a correct change. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js >index 8f2c3d3ab27..ee2722faa64 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js >@@ -68,6 +68,11 @@ class HttpClient { > const is_json = response.headers > .get("content-type") > ?.includes("application/json"); >+ >+ if (return_response || !is_json) { >+ return response; >+ } >+ > if (!response.ok) { > return response.text().then(text => { > let message; >@@ -83,9 +88,6 @@ class HttpClient { > throw new Error(message); > }); > } >- if (return_response || !is_json) { >- return response; >- } > return response.json(); > }) > .then(result => { >-- >2.50.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40173
:
183354
|
183355
|
183356
|
183920
|
183928
|
183994
|
183995
|
183996
|
183997
|
184098
|
184099
|
184100
|
184101
|
184323
| 184324 |
184325
|
184326