@@ -86,36 +86,36 @@ func TestAppProxyHandler(t *testing.T) {
8686
8787 // Get robots.txt
8888 rec := httptest .NewRecorder ()
89- req := httptest .NewRequest ( http .MethodGet , "https://hub.keboola.local/robots.txt" , nil )
89+ req := httptest .NewRequestWithContext ( t . Context (), http .MethodGet , "https://hub.keboola.local/robots.txt" , nil )
9090 handler .ServeHTTP (rec , req )
9191 require .Equal (t , http .StatusOK , rec .Code )
9292 assert .Contains (t , rec .Body .String (), "Disallow: /" )
9393
9494 // Get missing asset
9595 rec = httptest .NewRecorder ()
96- req = httptest .NewRequest ( http .MethodGet , "https://hub.keboola.local/_proxy/assets/foo.bar" , nil )
96+ req = httptest .NewRequestWithContext ( t . Context (), http .MethodGet , "https://hub.keboola.local/_proxy/assets/foo.bar" , nil )
9797 handler .ServeHTTP (rec , req )
9898 require .Equal (t , http .StatusNotFound , rec .Code )
9999
100100 // Invalid host
101101 rec = httptest .NewRecorder ()
102- req = httptest .NewRequest ( http .MethodGet , "https://public-123.foo.bar.local/path" , nil )
102+ req = httptest .NewRequestWithContext ( t . Context (), http .MethodGet , "https://public-123.foo.bar.local/path" , nil )
103103 req .Header .Set ("User-Agent" , "my-user-agent" )
104104 handler .ServeHTTP (rec , req )
105105 require .Equal (t , http .StatusBadRequest , rec .Code )
106106 assert .Contains (t , rec .Body .String (), "Unexpected domain, missing application ID." )
107107
108108 // Send logged request
109109 rec = httptest .NewRecorder ()
110- req = httptest .NewRequest ( http .MethodGet , "https://public-123.hub.keboola.local/path" , nil )
110+ req = httptest .NewRequestWithContext ( t . Context (), http .MethodGet , "https://public-123.hub.keboola.local/path" , nil )
111111 req .Header .Set ("User-Agent" , "my-user-agent" )
112112 handler .ServeHTTP (rec , req )
113113 require .Equal (t , http .StatusOK , rec .Code )
114114 assert .Equal (t , "Hello, client" , rec .Body .String ())
115115
116116 // Send ignored request
117117 rec = httptest .NewRecorder ()
118- req = httptest .NewRequest ( http .MethodGet , "https://hub.keboola.local/health-check" , nil )
118+ req = httptest .NewRequestWithContext ( t . Context (), http .MethodGet , "https://hub.keboola.local/health-check" , nil )
119119 req .Header .Set ("User-Agent" , "my-user-agent" )
120120 handler .ServeHTTP (rec , req )
121121 require .Equal (t , http .StatusOK , rec .Code )
0 commit comments