Skip to content

Commit

Permalink
Merge pull request #497 from sklump/accommodate-no-endpoints
Browse files Browse the repository at this point in the history
do not crash on connection request/response creation if no endpoints …
  • Loading branch information
andrewwhitehead authored May 8, 2020
2 parents f6d53df + 21b2dd1 commit 4db02e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions aries_cloudagent/protocols/connections/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ async def create_request(

# Create connection request message
if not my_endpoint:
my_endpoints = [self.context.settings.get("default_endpoint")]
my_endpoints = []
default_endpoint = self.context.settings.get("default_endpoint")
if default_endpoint:
my_endpoints.append(default_endpoint)
my_endpoints.extend(self.context.settings.get("additional_endpoints", []))
else:
my_endpoints = [my_endpoint]
Expand Down Expand Up @@ -478,7 +481,10 @@ async def create_response(

# Create connection response message
if not my_endpoint:
my_endpoints = [self.context.settings.get("default_endpoint")]
my_endpoints = []
default_endpoint = self.context.settings.get("default_endpoint")
if default_endpoint:
my_endpoints.append(default_endpoint)
my_endpoints.extend(self.context.settings.get("additional_endpoints", []))
did_doc = await self.create_did_document(
my_info, connection.inbound_connection_id, my_endpoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def setUp(self):
{
"default_endpoint": "http://aries.ca/endpoint",
"default_label": "This guy",
"additional_endpoints": [],
"additional_endpoints": ["http://aries.ca/another-endpoint"],
"debug.auto_accept_invites": True,
"debug.auto_accept_requests": True,
}
Expand Down

0 comments on commit 4db02e7

Please sign in to comment.