Description
Lucas Gass (lukeg)
2024-03-25 16:27:54 UTC
Created attachment 163837 [details] [review] Bug 36418: Explicitly set response to json To test: 1. Add some checkouts and load the issues-table 2. Select 'Check in' checkbox for that item and click "Check in selected items" 3. The row becomes read and reads "Unable to check in" 4. Reload the page, the item has actually checked in 5. Try the 'Renew' checkbox and click "Renew selected items" 6. It just spins and spins. 7. Reload the page, the item has actually renewed. 8. APPLY PATCH and restart_all 9. Try the steps again and this time everything should work properly. Is this the correct fix and if so, do all the svc/* files need it? Created attachment 163885 [details] [review] 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 (In reply to Lucas Gass from comment #2) > Is this the correct fix and if so, do all the svc/* files need it? Yes, I have also found other scripts that need the change. Thanks for catching that! Created attachment 163922 [details] [review] Bug 36418: Explicitly set response to json To test: 1. Add some checkouts and load the issues-table 2. Select 'Check in' checkbox for that item and click "Check in selected items" 3. The row becomes read and reads "Unable to check in" 4. Reload the page, the item has actually checked in 5. Try the 'Renew' checkbox and click "Renew selected items" 6. It just spins and spins. 7. Reload the page, the item has actually renewed. 8. APPLY PATCH and restart_all 9. Try the steps again and this time everything should work properly. Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Created attachment 163923 [details] [review] 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 <blawlor@clamsnet.org> >> Is this the correct fix and if so, do all the svc/* files need it?
> Yes
Maybe these two then?
svc/recall
svc/mana/increment
What about the OPAC?
opac/svc/club/enroll
opac/svc/club/cancel_enrollment
(In reply to Victor Grousset/tuxayo from comment #7) > >> Is this the correct fix and if so, do all the svc/* files need it? > > Yes > > Maybe these two then? > svc/recall I missed this one it seems. > svc/mana/increment I don't know, it's not obvious what is the return. Please investigate (test) and you will see if it returns JSON or something else. > What about the OPAC? > opac/svc/club/enroll > opac/svc/club/cancel_enrollment If they output JSON, yes they should. >> svc/recall >I missed this one it seems. This one indeed outputs JSON >> svc/mana/increment > I don't know, it's not obvious what is the return. > Please investigate (test) and you will see if it returns JSON or something else. It seems the return is nothing. From the code, and from testing. >> opac/svc/club/enroll >> opac/svc/club/cancel_enrollment >If they output JSON, yes they should. enroll: after testing, yes it does cancel_enrollment: last two lines > print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); > print to_json( { success => $enrollment ? 1 : 0 } ); lol, yes also A `type => 'text/plain'` just above a `print to_json` So work needed on 3 of the 4 suspected files. > A `type => 'text/plain'` just above a `print to_json` That's not the only case >_< randomly opened serials/subscription-frequency.pl and there is: > print $input->header(-type => 'text/plain', -charset => 'UTF-8'); > print to_json( $frequencyrecord ); Is that still relevant for this ticket? Leaning towards no. Can you provide a follow-up maybe? Created attachment 164066 [details] [review] Bug 36418: Catch more cases where header respose should be application/json Created attachment 164094 [details] [review] Bug 36418: Explicitly set response to json To test: 1. Add some checkouts and load the issues-table 2. Select 'Check in' checkbox for that item and click "Check in selected items" 3. The row becomes read and reads "Unable to check in" 4. Reload the page, the item has actually checked in 5. Try the 'Renew' checkbox and click "Renew selected items" 6. It just spins and spins. 7. Reload the page, the item has actually renewed. 8. APPLY PATCH and restart_all 9. Try the steps again and this time everything should work properly. 10. tests these URLs http://localhost:8081/cgi-bin/koha/svc/recall http://localhost:8080/cgi-bin/koha/svc/club/enroll http://localhost:8081/cgi-bin/koha/svc/mana/increment : empty response Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Created attachment 164095 [details] [review] 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 <blawlor@clamsnet.org> Created attachment 164096 [details] [review] Bug 36418: Catch more cases where header response should be application/json Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 164097 [details] [review] Bug 36418: opac/svc/club: switch content-type to application/json Tested & SOed Lucas' follow-up, and added another follow-up for the OPAC cases. Amended test plan to add the URLs used to test Lucas' follow-up and mine partially. Created attachment 164102 [details] [review] Bug 36418: Explicitly set response to json To test: 1. Add some checkouts and load the issues-table 2. Select 'Check in' checkbox for that item and click "Check in selected items" 3. The row becomes read and reads "Unable to check in" 4. Reload the page, the item has actually checked in 5. Try the 'Renew' checkbox and click "Renew selected items" 6. It just spins and spins. 7. Reload the page, the item has actually renewed. 8. APPLY PATCH and restart_all 9. Try the steps again and this time everything should work properly. 10. tests these URLs http://localhost:8081/cgi-bin/koha/svc/recall http://localhost:8080/cgi-bin/koha/svc/club/enroll http://localhost:8081/cgi-bin/koha/svc/mana/increment : empty response Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 164103 [details] [review] 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 <blawlor@clamsnet.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 164104 [details] [review] Bug 36418: Catch more cases where header response should be application/json Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Created attachment 164105 [details] [review] Bug 36418: opac/svc/club: switch content-type to application/json Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed for 24.05! Well done everyone, thank you! Depends on bug 36351 not in 23.11.x |