Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Handling a BOM with .json() #541

@pjirsa

Description

@pjirsa

Anybody know how I should be handling a BOM with a returned json payload? Right now i'm getting this error when calling res.json()
Exception: FetchError: invalid json response body at https://api_that_returns_json_with_bom reason: Unexpected token ? in JSON at position 0

I tried adding an Accept header of application/json; charset=utf-8 but that didn't resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions