Skip to content

application/json accept header included even when no data passed #60

Open
@carueda

Description

@carueda

When no explicit Accept header nor any json payload (e.g., foo=bar, quz=42) are specified in the request, the following is a difference in handling wrt httpie:

$ curlie -v get http://example.net
* ...
GET / HTTP/1.1
Host: example.net
User-Agent: curl/7.64.1
Accept: application/json, */*

HTTP/1.1 200 OK
...

That is, curlie includes and gives preference to application/json in the Accept header in these cases. In contrast, httpie simply includes Accept: */*, which seems more flexible in general:

$ http -v get http://example.net
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: example.net
User-Agent: HTTPie/3.2.1
...

fwiw, CURL itself also just includes Accept: */*:

➜  ~ curl -v http://example.net
*   Trying 2606:2800:220:1:248:1893:25c8:1946...
* TCP_NODELAY set
* Connected to example.net (2606:2800:220:1:248:1893:25c8:1946) port 80 (#0)
> GET / HTTP/1.1
> Host: example.net
> User-Agent: curl/7.64.1
> Accept: */*
>
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions