Skip to content

Parser error on non-json body #7

Open
@w-a-b

Description

@w-a-b

This library seems to be abandoned, but I post this in case others stumble upon the same problem (ended up using raw fetch instead of apicase for this):

If I invoke an endpoint that returns an Image / ReadableStream, I will get a JSON.stringify error unless I specify a parser other than "json" in the payload. The param should be a String, according to the docs:

// Response parser // default: 'json' "parser": String,

However, the code seems to expect an object like

{done: 'someParser', fail: 'json'}

And even with the parser-option defined like this, it will then fail on line 95 of index.js:
return res[parser]()

Why does the line above expect a parser function on the raw res(ult)-object from fetch?

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