Skip to content

Commit

Permalink
Use httpbingo for reverse proxy plugin too which is tested in workf…
Browse files Browse the repository at this point in the history
…lows
  • Loading branch information
abhinavsingh committed Apr 11, 2024
1 parent 93f9a94 commit 0049132
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proxy/plugin/reverse_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ def routes(self) -> List[Union[str, Tuple[str, List[bytes]]]]:
return [
# A static route
(
r'/get$',
[b'http://httpbin.org/get', b'https://httpbin.org/get'],
r"/get$",
[b"http://httpbingo.org/get", b"https://httpbingo.org/get"],
),
# A dynamic route to catch requests on "/get/<int>""
# See "handle_route" method below for what we do when
# this pattern matches.
r'/get/(\d+)$',
r"/get/(\d+)$",
]

def handle_route(self, request: HttpParser, pattern: RePattern) -> Url:
"""For our example dynamic route, we want to simply convert
any incoming request to "/get/1" into "/get?id=1" when serving from upstream.
"""
choice: Url = Url.from_bytes(b'http://httpbin.org/get')
choice: Url = Url.from_bytes(b"http://httpbingo.org/get")
assert request.path
result = re.search(pattern, request.path.decode())
if not result or len(result.groups()) != 1:
Expand Down

0 comments on commit 0049132

Please sign in to comment.