Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit e70978c

Browse files
committed
Let parse_request_respose handle HTTP errors.
1 parent e3d73ba commit e70978c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/oidcrp/oauth2/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,17 @@ def get_response(self, service, url, method="GET", body=None, response_body_type
128128
if 300 <= resp.status_code < 400:
129129
return {'http_response': resp}
130130

131-
if "keyjar" not in kwargs:
132-
kwargs["keyjar"] = service.service_context.keyjar
133-
if not response_body_type:
134-
response_body_type = service.response_body_type
131+
if resp.status_code < 300:
132+
if "keyjar" not in kwargs:
133+
kwargs["keyjar"] = service.service_context.keyjar
134+
if not response_body_type:
135+
response_body_type = service.response_body_type
135136

136-
if response_body_type == 'html':
137-
return resp.text
137+
if response_body_type == 'html':
138+
return resp.text
138139

139-
if body:
140-
kwargs['request_body'] = body
140+
if body:
141+
kwargs['request_body'] = body
141142

142143
return self.parse_request_response(service, resp,
143144
response_body_type, **kwargs)

0 commit comments

Comments
 (0)