Merge pull request #14 from hahahannes/own_well_known_endpoint

added possibility to define own .well-known-core endpoint
Mesure-preliminaire
Giacomo Tanganelli 3 years ago committed by GitHub
commit 7987ac9f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,11 +53,12 @@ class ForwardLayer(object):
:rtype : Transaction :rtype : Transaction
:return: the edited transaction :return: the edited transaction
""" """
wkc_resource_is_defined = defines.DISCOVERY_URL in self._server.root
path = str("/" + transaction.request.uri_path) path = str("/" + transaction.request.uri_path)
transaction.response = Response() transaction.response = Response()
transaction.response.destination = transaction.request.source transaction.response.destination = transaction.request.source
transaction.response.token = transaction.request.token transaction.response.token = transaction.request.token
if path == defines.DISCOVERY_URL: if path == defines.DISCOVERY_URL and not wkc_resource_is_defined:
transaction = self._server.resourceLayer.discover(transaction) transaction = self._server.resourceLayer.discover(transaction)
else: else:
new = False new = False

@ -52,11 +52,12 @@ class RequestLayer(object):
:rtype : Transaction :rtype : Transaction
:return: the edited transaction with the response to the request :return: the edited transaction with the response to the request
""" """
wkc_resource_is_defined = defines.DISCOVERY_URL in self._server.root
path = str("/" + transaction.request.uri_path) path = str("/" + transaction.request.uri_path)
transaction.response = Response() transaction.response = Response()
transaction.response.destination = transaction.request.source transaction.response.destination = transaction.request.source
transaction.response.token = transaction.request.token transaction.response.token = transaction.request.token
if path == defines.DISCOVERY_URL: if path == defines.DISCOVERY_URL and not wkc_resource_is_defined:
transaction = self._server.resourceLayer.discover(transaction) transaction = self._server.resourceLayer.discover(transaction)
else: else:
try: try:

@ -201,3 +201,6 @@ class Tree(object):
def __delitem__(self, key): def __delitem__(self, key):
del self.tree[key] del self.tree[key]
def __contains__(self, item):
return item in self.tree

Loading…
Cancel
Save