mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-10-27 11:18:14 +03:00
esim/http_json_api.py: fixup for text/plain response Content-Type
fixup for 4ba09440bf -- for this to work,
we need to remove the check that the response content type must match
the request content type.
As I am testing invigo fetch-profile, which returns a
text/plain;charset=UTF-8, I realize that completely removing the check
is indeed necessary.
Change-Id: I6429cb9f7bcbab7c07ea66ed45f63ac3a77bf5bd
This commit is contained in:
1 parent
23ac6d9a98
commit
2dfcae73ea
1 file changed
+1
-3
@@ -411,14 +411,12 @@ class JsonHttpApiClient():
|
|||||||
# SGP.22, section 6.5.1)
|
# SGP.22, section 6.5.1)
|
||||||
if response.status_code != self.api_func.expected_http_status:
|
if response.status_code != self.api_func.expected_http_status:
|
||||||
raise HttpStatusError(response)
|
raise HttpStatusError(response)
|
||||||
resp_content_type = response.headers.get('Content-Type')
|
|
||||||
if response.content and not resp_content_type.startswith(req_headers['Content-Type']):
|
|
||||||
raise HttpHeaderError(response)
|
|
||||||
if not response.headers.get('X-Admin-Protocol', 'gsma/rsp/v2.unknown').startswith('gsma/rsp/v2.'):
|
if not response.headers.get('X-Admin-Protocol', 'gsma/rsp/v2.unknown').startswith('gsma/rsp/v2.'):
|
||||||
raise HttpHeaderError(response)
|
raise HttpHeaderError(response)
|
||||||
|
|
||||||
# Decode response and return the result back to the caller
|
# Decode response and return the result back to the caller
|
||||||
if response.content:
|
if response.content:
|
||||||
|
resp_content_type = response.headers.get('Content-Type')
|
||||||
if resp_content_type.startswith('application/json'):
|
if resp_content_type.startswith('application/json'):
|
||||||
output = self.api_func.decode_client(response.json())
|
output = self.api_func.decode_client(response.json())
|
||||||
elif resp_content_type.startswith('text/plain;charset=UTF-8'):
|
elif resp_content_type.startswith('text/plain;charset=UTF-8'):
|
||||||
|
|||||||
Reference in new issue
Block a user