Bug 41143

Summary: Searching EBSCO packages results in 500 error due to Content-type
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ERMAssignee: Jonathan Druart <jonathan.druart>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew.auld, jonathan.druart, jonathan.field, martin.renvoize, matt.blenkinsop, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 33481    
Bug Blocks:    
Attachments: Bug 41143: Do not include content-type header when searching packages

Description Pedro Amorim 2025-10-30 14:48:07 UTC

    
Comment 1 Pedro Amorim 2025-10-30 14:49:27 UTC
We started getting these errors when searching for packages in ERM eHoldings:

[2025/10/30 14:18:08] [WARN] ERROR - EBSCO API /packages?orderby=packagename&offset=1&count=1 returned 400 - The value 'application/json; charset=UTF-8' is not valid for the 'contenttype' parameter. Allowed values: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, all, aggregatedfulltext, abstractandindex, ebook, ejournal, print, unknown, onlinereference, streamingmedia, mixedcontent}.
[2025/10/30 14:18:08] [ERROR] GET /api/v1/erm/eholdings/ebsco/packages: unhandled exception (Mojo::Exception)<<ERROR requesting EBSCO API
/packages?orderby=packagename&offset=1&count=1
code 400: The value 'application/json; charset=UTF-8' is not valid for the 'contenttype' parameter. Allowed values: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, all, aggregatedfulltext, abstractandindex, ebook, ejournal, print, unknown, onlinereference, streamingmedia, mixedcontent}.>>

Reverting bug 33481 appears to prevent this from happening. But this looks weird, there seems to be something happening with contenttype vs content-type in the request.
Comment 2 Pedro Amorim 2025-10-30 15:12:46 UTC
Reverting bug 33481 appears to cause things to go wrong with selecting and deselecting titles and packages so a proper fix is required here.
Comment 3 Jonathan Druart 2025-11-03 11:47:39 UTC
The error does not mean anything, why are they using the content-type header as a parameter?

The doc:
https://developer.ebsco.com/knowledge-services/reference/findpackagesbynameusingget
there is indeed a contenttype parameter

I would contact them and ask what changed and if this behaviour is the expected one, maybe it's a bug on their side.
Comment 4 Jonathan Druart 2025-11-03 11:57:30 UTC
Created attachment 188926 [details] [review]
Bug 41143: Do not include content-type header when searching packages
Comment 5 Jonathan Druart 2025-11-03 11:58:28 UTC
This patch fixes the problem if you need a hotfix.