@@ -193,3 +193,42 @@ def test_log_frame_header(monkeypatch, capsys):
193193 captured = capsys .readouterr ()
194194 assert "\n foo=12345\n " in captured .out
195195 assert "\n foo=12345\n " in captured .err
196+
197+
198+ @pytest .mark .asyncio
199+ async def test_request_url_and_method_no_gateway ():
200+ url_path = "/call"
201+ method = "POST"
202+ call = await fixtures .setup_fn_call (
203+ funcs .access_request_url ,
204+ request_url = url_path ,
205+ method = method ,
206+ )
207+ content , status , headers = await call
208+
209+ assert "response-request-url" in headers
210+ assert "request-method" in headers
211+
212+ assert url_path == headers .get ("response-request-url" )
213+ assert method == headers .get ("request-method" )
214+
215+
216+ @pytest .mark .asyncio
217+ async def test_request_url_and_method_with_gateway ():
218+ url_path = "/t/app/path"
219+ method = "GET"
220+ call = await fixtures .setup_fn_call (
221+ funcs .access_request_url ,
222+ request_url = url_path ,
223+ method = method ,
224+ gateway = True
225+ )
226+ content , status , headers = await call
227+
228+ assert "response-request-url" not in headers
229+ assert "request-method" not in headers
230+ assert "fn-http-h-response-request-url" in headers
231+ assert "fn-http-h-request-method" in headers
232+
233+ assert url_path == headers .get ("fn-http-h-response-request-url" )
234+ assert method == headers .get ("fn-http-h-request-method" )
0 commit comments