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
Of course this works fine, but it's done via trying and failing because the url is weird. I'm wondering if we might want to do checks first to see if replacements haven't been done, and raise an error before doing any request. For example in Python:
# would match if we forgot to fill in a replacement for a template stringre.search('<.+>', req.url)
Ah hold the phone! The validation is already there, I somehow forgot this since yesterday and today 👍
def validateRequest(req):
"""Ensure that we have no unfilled template strings"""
regex = re.compile("<name>|<reference>|<digest>|<session_id>|//{2,}")
if not req.url:
raise ValueError("A url is required to prepare a request.")
if not req.method:
raise ValueError("A method is required to prepare a request")
if regex.search(req.url):
raise ValueError("request is invalid")`
There is a test that expects raising an error because the
<reference>
is not defined, and I can indeed reproduce this because the url turns out to be:Of course this works fine, but it's done via trying and failing because the url is weird. I'm wondering if we might want to do checks first to see if replacements haven't been done, and raise an error before doing any request. For example in Python:
The current client doesn't do any checks to see if replacements aren't defined.
I'll leave the reggie-python version to match this one for the time being, and we can possibly update both if it seems like a good idea.
The text was updated successfully, but these errors were encountered: