issues: 1189113609
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | pull_request | body | repo | type | active_lock_reason | performed_via_github_app | reactions | draft | state_reason |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1189113609 | I_kwDOBm6k_c5G4G8J | 1697 | `Request.fake(..., url_vars={})` | 9599 | closed | 0 | 3268330 | 1 | 2022-04-01T01:48:40Z | 2022-04-01T02:02:18Z | 2022-04-01T02:02:10Z | OWNER | I just created an alternative `.fake()` method because I wanted to fake the `url_vars` captured in the route as well: ```python from datasette.utils.asgi import Request class Request(Request): @classmethod def fake(cls, path_with_query_string, method="GET", scheme="http", url_vars=None): """Useful for constructing Request objects for tests""" path, _, query_string = path_with_query_string.partition("?") scope = { "http_version": "1.1", "method": method, "path": path, "raw_path": path_with_query_string.encode("latin-1"), "query_string": query_string.encode("latin-1"), "scheme": scheme, "type": "http", } if url_vars: scope["url_route"] = { "kwargs": url_vars } return cls(scope, None) ``` | 107914493 | issue | {"url": "https://api.github.com/repos/simonw/datasette/issues/1697/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | completed |