File tree Expand file tree Collapse file tree
phylesystem_api/phylesystem_api/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -167,7 +167,6 @@ def fetch_and_cache(url):
167167 msg = "... and now we're back with fetched, which is a {}"
168168 msg = msg .format (type (fetched ))
169169 _LOG .warning (msg )
170- fetched .raise_for_status ()
171170 fetched .encoding = "utf-8" # Optional: requests infers this internally
172171
173172 # modify or discard "hop-by-hop" headers
@@ -180,8 +179,8 @@ def fetch_and_cache(url):
180179 ct = "text/plain"
181180 return Response (
182181 headers = fetched .headers ,
183- body = fetched .text , # missing JSON payload will raise an error
184- status = "200 OK" ,
182+ body = fetched .text ,
183+ status_code = fetched . status_code , # keep the returned status code!
185184 charset = "UTF-8" ,
186185 content_type = ct ,
187186 )
@@ -192,7 +191,7 @@ def fetch_and_cache(url):
192191 raise HTTPException (body = str (e ))
193192 except Exception as e :
194193 _LOG .warning (" UNKNOWN request exception: {}" .format (str (e )))
195- raise HTTPBadRequest (body = "Unknown exception in cached call!" )
194+ raise HTTPBadRequest (body = "Unknown exception in cached call! Check server log for details. " )
196195
197196 _LOG .warning ("...trying to fetch-and-cache..." )
198197 return fetch_and_cache (target_url )
You can’t perform that action at this time.
0 commit comments