Skip to content

Commit 4620a1e

Browse files
committed
Library will set Content-Type multipart/form-data if we use the 'files' keyword argument.
1 parent 20678f7 commit 4620a1e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

microsoftgraph/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,17 @@ def _delete(self, url, **kwargs):
605605
def _request(self, method, url, headers=None, **kwargs):
606606
_headers = {
607607
'Accept': 'application/json',
608-
'Content-Type': 'application/json'
609608
}
610609
if self.office365:
611610
_headers['Authorization'] = 'Bearer ' + self.office365_token['access_token']
612611
else:
613612
_headers['Authorization'] = 'Bearer ' + self.token['access_token']
614613
if headers:
615614
_headers.update(headers)
615+
if 'files' not in kwargs:
616+
# If you use the 'files' keyword, the library will set the Content-Type to multipart/form-data
617+
# and will generate a boundary.
618+
_headers['Content-Type'] = 'application/json'
616619
return self._parse(requests.request(method, url, headers=_headers, **kwargs))
617620

618621
def _parse(self, response):

0 commit comments

Comments
 (0)