forked from extern/httpie-cli
parent
9b2a293e6e
commit
6e5c696ac9
@ -46,7 +46,7 @@ def get_requests_kwargs(args):
|
||||
auto_json = args.data and not args.form
|
||||
if args.json or auto_json:
|
||||
implicit_headers['Accept'] = 'application/json'
|
||||
if args.data:
|
||||
if args.json or (auto_json and args.data):
|
||||
implicit_headers['Content-Type'] = JSON
|
||||
|
||||
if isinstance(args.data, dict):
|
||||
|
@ -436,7 +436,9 @@ class AutoContentTypeAndAcceptHeadersTest(BaseTestCase):
|
||||
)
|
||||
self.assertIn(OK, r)
|
||||
self.assertEqual(r.json['headers']['Accept'], 'application/json')
|
||||
self.assertFalse(r.json['headers'].get('Content-Type'))
|
||||
# Make sure Content-Type gets set even with no data.
|
||||
# https://github.com/jkbr/httpie/issues/137
|
||||
self.assertIn('application/json', r.json['headers']['Content-Type'])
|
||||
|
||||
def test_GET_explicit_JSON_explicit_headers(self):
|
||||
r = http(
|
||||
|
Loading…
Reference in New Issue
Block a user