You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for developing and documenting repsx, it is extremely useful.
One such useful features is the json pattern path traversing.
However I am having an issue that if I don't have a matching pattern before one where I use path traversing I get an error if my request has json but not that key.
self = <JSON eq '"refresh_token"'>, request = <Request('POST', 'https://app.diffhost.net/items/hFj8G5/endpoint')> def parse(self, request: httpx.Request) -> str: content = super().parse(request) try: json = jsonlib.loads(content.decode("utf-8")) except JSONDecodeError: return "" if self.path: value = json for bit in self.path.split("__"): key = int(bit) if bit.isdigit() else bit try: value = value[key] except KeyError as e:
> raise KeyError(f"{self.path!r} not in {json!r}") from eE KeyError: "'grant_type' not in {'type': 'example'}"
Expected:
I would expect the KeyError to result in a non-match pattern, not an exception being raised.
Additionally it seems odd to me that since the base_url and path both do not match that the rest of the pattern is even checked. I presume using pattern = M(path...) & M(json...) would not change this?
The text was updated successfully, but these errors were encountered:
Thanks for developing and documenting repsx, it is extremely useful.
One such useful features is the json pattern path traversing.
However I am having an issue that if I don't have a matching pattern before one where I use path traversing I get an error if my request has json but not that key.
Result:
Expected:
I would expect the KeyError to result in a non-match pattern, not an exception being raised.
Additionally it seems odd to me that since the base_url and path both do not match that the rest of the pattern is even checked. I presume using
pattern = M(path...) & M(json...)
would not change this?The text was updated successfully, but these errors were encountered: