Skip to content

Commit e69fee6

Browse files
jfilakphanak-sap
authored andcommitted
client: correctly detect MIME of $metadata
I didn't expect that metadata will be send in anything else that ASCII. But we absolutely need to know the charse because of labels. Northwind returns "Content-Type: application/xml;charset=utf-8" Closes #1
1 parent 9c23ff8 commit e69fee6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyodata/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __new__(cls, url, connection, odata_version=ODATA_VERSION_2):
3737
'Metadata request failed, status code: {}, body:\n{}'.format(resp.status_code, resp.content), resp)
3838

3939
mime_type = resp.headers['content-type']
40-
if mime_type not in ['application/xml', 'text/xml']:
40+
if not any((typ in ['application/xml', 'text/xml'] for typ in mime_type.split(';'))):
4141
raise HttpError(
4242
'Metadata request did not return XML, MIME type: {}, body:\n{}'.format(mime_type, resp.content),
4343
resp)

0 commit comments

Comments
 (0)