Skip to content

Commit

Permalink
Change default JSON Accept to application/json, */*;q=0.5
Browse files Browse the repository at this point in the history
See #488
  • Loading branch information
jkbrzt committed Apr 18, 2020
1 parent 83bd805 commit fc85988
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tests for the provided defaults regarding HTTP method, and --json vs. --form.
"""
from httpie.client import EXPLICIT_JSON_ACCEPT, AUTO_JSON_ACCEPT
from httpie.client import JSON_ACCEPT
from utils import MockEnvironment, http, HTTP_OK
from fixtures import FILE_PATH

Expand Down Expand Up @@ -75,20 +75,20 @@ def test_POST_no_data_no_auto_headers(self, httpbin):
def test_POST_with_data_auto_JSON_headers(self, httpbin):
r = http('POST', httpbin.url + '/post', 'a=b')
assert HTTP_OK in r
assert r.json['headers']['Accept'] == AUTO_JSON_ACCEPT
assert r.json['headers']['Accept'] == JSON_ACCEPT
assert r.json['headers']['Content-Type'] == 'application/json'

def test_GET_with_data_auto_JSON_headers(self, httpbin):
# JSON headers should automatically be set also for GET with data.
r = http('POST', httpbin.url + '/post', 'a=b')
assert HTTP_OK in r
assert r.json['headers']['Accept'] == AUTO_JSON_ACCEPT
assert r.json['headers']['Accept'] == JSON_ACCEPT
assert r.json['headers']['Content-Type'] == 'application/json'

def test_POST_explicit_JSON_JSON_ACCEPT(self, httpbin):
r = http('--json', 'POST', httpbin.url + '/post')
assert HTTP_OK in r
assert r.json['headers']['Accept'] == EXPLICIT_JSON_ACCEPT
assert r.json['headers']['Accept'] == JSON_ACCEPT
# Make sure Content-Type gets set even with no data.
# https://github.com/jakubroztocil/httpie/issues/137
assert 'application/json' in r.json['headers']['Content-Type']
Expand Down

0 comments on commit fc85988

Please sign in to comment.