Skip to content

HttpRequest.getString() recommended by docs for fetching JSON, but demands "text/" mime response #21578

Open
@Valloric

Description

Headline doc entry for HttpRequest: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:html.HttpRequest

> The simplest way to get the contents of a text file, such as a JSON-formatted file, is with getString. [example follows]

Docs for getString (same page):

> The server response must be a text/ mime type for this request to succeed.

Official mimetype for JSON: http://en.wikipedia.org/wiki/JSON#MIME_type

> The official MIME type for JSON text is "application/json".

These three facts put together make zero sense. Either getString should work with responses that aren't "text/" (makes the most sense), or the docs shouldn't recommend the use of this method for JSON.

Metadata

Assignees

No one assigned

    Labels

    area-webUse area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.library-htmltype-documentationA request to add or improve documentationweb-librariesIssues impacting dart:html, etc., libraries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions