Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Fix parsing "host" and "post" in "attach" request.
Browse files Browse the repository at this point in the history
  • Loading branch information
int19h committed Aug 12, 2019
1 parent c5feeea commit 9f37496
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ptvsd/common/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ def __call__(self, key, validate, optional=False):
If validate=False, it's treated as if it were (lambda x: x) - i.e. any value
is considered valid, and is returned unchanged. If validate is a type or a
tuple, it's treated as if it were json.of_type(validate).
tuple, it's treated as json.of_type(validate). Otherwise, if validate is not
callable(), it's treated as json.default(validate).
If validate() returns successfully, the item is substituted with the value
it returns - thus, the validator can e.g. replace () with a suitable default
Expand All @@ -373,6 +374,8 @@ def __call__(self, key, validate, optional=False):
validate = lambda x: x
elif isinstance(validate, type) or isinstance(validate, tuple):
validate = json.of_type(validate)
elif not callable(validate):
validate = json.default(validate)

value = self.get(key, ())
try:
Expand Down

0 comments on commit 9f37496

Please sign in to comment.