Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit ee46aec

Browse files
committed
Added Content-Type header for keys POST cases.
1 parent a8923f5 commit ee46aec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
an ``adapter`` arg of a ``Replay429Adapter`` with the desired number of retries and initial backoff. To replicate
1616
the 2.0.0 behaviour use: ``adapter=Replay429Adapter(retries=10, initialBackoff=0.25)``. If ``retries`` or
1717
``initialBackoff`` are not specified they will default to 3 retries and a 0.25 s initial backoff.
18+
- [FIX] ``415 Client Error: Unsupported Media Type`` when using keys with ``db.all_docs``.
1819

1920
2.0.3 (2016-06-03)
2021
==================

src/cloudant/_common_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ def get_docs(r_session, url, encoder=None, headers=None, **params):
251251
if keys_list:
252252
keys = json.dumps({'keys': keys_list}, cls=encoder)
253253
f_params = python_to_couch(params)
254-
255254
resp = None
256255
if keys:
256+
# If we're using POST we are sending JSON so add the header
257+
if headers is None:
258+
headers = {}
259+
headers['Content-Type'] = 'application/json'
257260
resp = r_session.post(url, headers=headers, params=f_params, data=keys)
258261
else:
259262
resp = r_session.get(url, headers=headers, params=f_params)

0 commit comments

Comments
 (0)