Skip to content

Feature request: the ability to indicate content-type when the server does not provide it #92

@ccp-ccollins

Description

@ccp-ccollins

Sometimes I am forced to get data from a server that has a consistent API (for example, it always returns JSON) but does not set the Content-Type header. In these cases, it appears that resty does not automatically parse the response automatically with SetResponse().

In cases where I know for sure what data should be expected, I'd like to be able to indicate that, rather than reading the body and parsing manually. For example, it could be something like this:

resty.R().
    SetResult(&output).
    ExpectContent("application/json").
    Get(url)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions