This is a regression against the PHP version.
Fixes #3138.
body of the response to 'output'.
"""
+ @abc.abstractmethod
+ def base_uri(self) -> str:
+ """ Return the URI of the original request.
+ """
+
@abc.abstractmethod
def config(self) -> Configuration:
(str(r.place_id) for r in results if r.place_id))
queryparts['format'] = fmt
- moreurl = urlencode(queryparts)
+ moreurl = params.base_uri() + '/search?' + urlencode(queryparts)
else:
moreurl = ''
self.response.content_type = self.content_type
+ def base_uri(self) -> str:
+ return cast (str, self.request.forwarded_prefix)
+
def config(self) -> Configuration:
return self._config
return Response(output, status_code=status, media_type=self.content_type)
+ def base_uri(self) -> str:
+ scheme = self.request.url.scheme
+ host = self.request.url.hostname
+ port = self.request.url.port
+ root = self.request.scope['root_path']
+ if (scheme == 'http' and port == 80) or (scheme == 'https' and port == 443):
+ port = None
+ if port is not None:
+ return f"{scheme}://{host}:{port}{root}"
+
+ return f"{scheme}://{host}{root}"
+
+
def config(self) -> Configuration:
return cast(Configuration, self.request.app.state.API.config)
return FakeResponse(status, output, self.content_type)
+ def base_uri(self) -> str:
+ return 'http://test'
+
def config(self):
return self._config