Skip to content

Ability for Declarative HTTP Client to consume APIs that do not include content-type headers in response #5978

Open
@tonyerskine

Description

@tonyerskine

Feature description

When consuming legacy, external ReST services that do not include Content-Type headers with their responses, I would like to be able to advise the declarative, HTTP client to parse responses using the Consumes annotation.

For example, it would be nice if the following method would default to parsing the response body as JSON if the response doesn't contain the Content-Type header because it's annotated to consume JSON.

    @Post
    @Consumes(MediaType.APPLICATION_JSON)
    HttpResponse<TokenResponse> postToken(@NotNull @Body String token)

see also: https://stackoverflow.com/questions/68761358/grails-4-micronaut-http-client-failing-to-bind-response/68774041#68774041

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions