Skip to content

JSON conversion fails after fetch with template literal #672

@PHvL

Description

@PHvL

Hi,
I'm trying to update to v0.9.91.

If we use template literals in fetch, a conversion to JSON fails:

fetch `/api?${#form as Values | FormEncoded}` as JSON

fails with "Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
Same for

set params to 'study_id=163017051' fetch `/api?${params}` as JSON

explicitely putting the form data as string

fetch /api?study_id=163017051 as JSON

works.

Since

fetch `/api?${#form as Values | FormEncoded}` as Text

fails with "Uncaught Error: Unknown conversion : Text", my suspicion is, that the internal output of #form as Values | FormEncoded is fed to the external conversion.

Am I doing something wrong?

Best regards
Philipp

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