[Koha-bugs] [Bug 28201] Add API routes to create biblio record

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jan 27 03:24:07 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28201

--- Comment #10 from David Cook <dcook at prosentient.com.au> ---
(In reply to Tomás Cohen Arazi from comment #9)
> (In reply to David Cook from comment #8)
> > Looking at
> > https://docs.mojolicious.org/Mojolicious/Plugin/DefaultHelpers#respond_to
> > and it looks to me like Koha/REST/V1/Biblios.pm might actually be a bit
> > inefficient. It looks like it runs every output option (e.g.
> > "as_xml_record", "to_mij", "as_usmarc", "as_formatted") regardless of what
> > content type is actually served to the user... might be worthwhile wrapping
> > those method calls in anonymous functions...
> > 
> > But that's neither here nor there 😅
> 
> I don't think it is working as you suggest. Not I read the docs the same way
> you do. Let's run it on a debugger.

There is a little error in what I said. If application/json is sent as an
Accept header, then only a JSON response will be generated. However, looking at
the code, if application/json is not sent in the Accept header, then we're
creating a hash composed of marcxml, mij, marc, txt, and any keys with their
corresponding values. That's just straight up Perl code.

That said, it is possible I'm wrong about wrapping the method calls in
anonymous functions though. I don't think the method should be called until the
anonymous function is run, but it could be worth checking with a debugger.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list