From 0f7941aa4a93427162e70a30d651bdd86d9794f7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 26 Mar 2024 08:41:21 +0100 Subject: [PATCH] Bug 36418: Set header response content type to application/json - svc We need to set the content type to application/json for the svc scripts returning json Signed-off-by: Brendan Lawlor --- svc/article_request | 2 +- svc/checkouts | 2 +- svc/club/cancel_enrollment | 2 +- svc/club/delete | 2 +- svc/club/enroll | 2 +- svc/club/template/delete | 2 +- svc/holds | 2 +- svc/mana/share | 2 +- svc/mana/use | 2 +- svc/return_claims | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/svc/article_request b/svc/article_request index 3760ae074d..3a9d56d731 100755 --- a/svc/article_request +++ b/svc/article_request @@ -35,7 +35,7 @@ if ( $auth_status ne "ok" ) { } binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $cgi->header( -type => 'application/json', -charset => 'UTF-8' ); my $id = $cgi->param('id'); my $op = $cgi->param('op') || q{}; diff --git a/svc/checkouts b/svc/checkouts index ae04eb9005..4c2ce32609 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -62,7 +62,7 @@ $sorting_direction = $sorting_direction eq 'asc' ? 'asc' : 'desc'; $results_per_page = undef if ( $results_per_page == -1 ); binmode STDOUT, ":encoding(UTF-8)"; -print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $input->header( -type => 'application/json', -charset => 'UTF-8' ); my @parameters; my $sql = ' diff --git a/svc/club/cancel_enrollment b/svc/club/cancel_enrollment index 3d4c2e8d9f..1726fbe0b9 100755 --- a/svc/club/cancel_enrollment +++ b/svc/club/cancel_enrollment @@ -41,6 +41,6 @@ my $enrollment = Koha::Club::Enrollments->find($id); $enrollment->cancel() if $enrollment; binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $cgi->header( -type => 'application/json', -charset => 'UTF-8' ); print to_json( { success => $enrollment ? 1 : 0 } ); diff --git a/svc/club/delete b/svc/club/delete index b320190679..1fb491ab81 100755 --- a/svc/club/delete +++ b/svc/club/delete @@ -44,6 +44,6 @@ if ($club && $op eq 'cud-delete') { } binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $cgi->header( -type => 'application/json', -charset => 'UTF-8' ); print to_json( { success => $success ? 1 : 0 } ); diff --git a/svc/club/enroll b/svc/club/enroll index 40d9391ad5..cb71eb3ffb 100755 --- a/svc/club/enroll +++ b/svc/club/enroll @@ -90,7 +90,7 @@ elsif ($club) { } binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $cgi->header( -type => 'application/json', -charset => 'UTF-8' ); if($enrollent_id){ print to_json( { success => @club_enrollment_fields ? 1 : 0 } ); diff --git a/svc/club/template/delete b/svc/club/template/delete index 095bfacee4..07a862ba0f 100755 --- a/svc/club/template/delete +++ b/svc/club/template/delete @@ -45,6 +45,6 @@ if ($club_template && $op eq 'cud-delete') { } binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $cgi->header( -type => 'application/json', -charset => 'UTF-8' ); print to_json( { success => $success ? 1 : 0 } ); diff --git a/svc/holds b/svc/holds index dde088e16a..eb40d2f2c7 100755 --- a/svc/holds +++ b/svc/holds @@ -56,7 +56,7 @@ my $iSortCol = $input->param('iSortCol_0') // 0; my $sorting_column = $sort_columns[$iSortCol] // 'reservedate'; binmode STDOUT, ":encoding(UTF-8)"; -print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $input->header( -type => 'application/json', -charset => 'UTF-8' ); my $holds_rs = Koha::Holds->search( { borrowernumber => $borrowernumber }, diff --git a/svc/mana/share b/svc/mana/share index f9978a9a19..548a56797b 100755 --- a/svc/mana/share +++ b/svc/mana/share @@ -28,7 +28,7 @@ use JSON; my $input = CGI->new; binmode STDOUT, ":encoding(UTF-8)"; -print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $input->header( -type => 'application/json', -charset => 'UTF-8' ); my ( $auth_status ) = check_cookie_auth( $input->cookie('CGISESSID'), diff --git a/svc/mana/use b/svc/mana/use index 0f7eb91d58..3b405549d5 100755 --- a/svc/mana/use +++ b/svc/mana/use @@ -30,7 +30,7 @@ use JSON; my $input = CGI->new; binmode STDOUT, ":encoding(UTF-8)"; -print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $input->header( -type => 'application/json', -charset => 'UTF-8' ); my ( $auth_status ) = check_cookie_auth( $input->cookie('CGISESSID'), diff --git a/svc/return_claims b/svc/return_claims index 726b756f83..42e48c55d5 100755 --- a/svc/return_claims +++ b/svc/return_claims @@ -67,7 +67,7 @@ $sorting_direction = $sorting_direction eq 'asc' ? 'asc' : 'desc'; $results_per_page = undef if ( $results_per_page == -1 ); binmode STDOUT, ":encoding(UTF-8)"; -print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); +print $input->header( -type => 'application/json', -charset => 'UTF-8' ); my $sql = qq{ SELECT -- 2.44.0