Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Use of codecs and codec plugins is very confusing #168

Description

@richard-reece

Hi, I just tried to use coreapi.Client().get() to load a page with content type "application/hal+json". I've got the hal-codec installed. It's not used though. For some reason the Client get() uses a hard-coded list of default codecs (get_default_decoders) rather than get_installed_codecs() which looks up all of the configured codecs (default and plugins). Is this just an oversight (a bug) or is this intentional and I'm using it wrong? In which case could the correct usage please be documented?

I see I can force the codec to be used by specifying the "format" (of "hal", not "application/hal+json") but that seems wrong as the code should be able to negotiate the codec based on the content-type, and it knows the full list of installed codecs (get_installed_codecs) but instead uses a partial list in its content-type lookup.

This seems to work, for both .get() and .action() on Client() instances but feels wrong:

 coreapi.Client(decoders=utils.get_installed_codecs().values())

I feel like I'm doing it wrong...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions