Skip to content

'GET' requests don't seem to include body #62

@sxh

Description

@sxh

I am integrating an application with ElasticSearch, and the search query API relies on sending the query in a JSON body attached to a get request (see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html for some examples).

I have been able to query the API this way from the command line using curl, and from Ruby using RestClient. When I try to do the same with Elm http the payload seems to get lost (I have checked the http request in Wireshark and compared it to the same request sent via Ruby).

The code used to set up the get request is shown below. The same code works as expected when I change the GET to POST, so I have a short term work around. Is dropping the payload on a GET request intended behaviour, or am I doing something wrong?

Http.request
{ method = "GET"
, headers = [ Http.header "Accept" "application/json" ]
, url = "https://(url here)/_search"
, body = Http.jsonBody jsonBodyValue
, expect = Http.expectJson SetProducts elasticSearchProductListDecoder
, timeout = Nothing
, tracker = Nothing
}

The send functions and returns a response, but the contents of the response is the same as when there is intentionally no query payload.

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