5
5
import com .gargoylesoftware .htmlunit .Page ;
6
6
import com .gargoylesoftware .htmlunit .TextPage ;
7
7
import com .gargoylesoftware .htmlunit .WebClient ;
8
- import com .gargoylesoftware .htmlunit .WebRequestSettings ;
8
+ import com .gargoylesoftware .htmlunit .WebRequest ;
9
9
import org .apache .commons .io .IOUtils ;
10
10
import org .kohsuke .stapler .interceptor .RequirePOST ;
11
11
import org .kohsuke .stapler .json .JsonBody ;
@@ -84,7 +84,7 @@ public void testVerbMatch() throws Exception {
84
84
}
85
85
86
86
private void check (WebClient wc , HttpMethod m ) throws java .io .IOException {
87
- TextPage p = wc .getPage (new WebRequestSettings (new URL (url , "verbMatch/" ), m ));
87
+ TextPage p = wc .getPage (new WebRequest (new URL (url , "verbMatch/" ), m ));
88
88
assertEquals ("Got " + m .name (), p .getContent ());
89
89
}
90
90
@@ -146,7 +146,7 @@ public void testInterceptorStage() throws Exception {
146
146
assertEquals (404 , e .getStatusCode ());
147
147
}
148
148
149
- WebRequestSettings req = new WebRequestSettings (new URL (url , "interceptorStage/foo" ), HttpMethod .POST );
149
+ WebRequest req = new WebRequest (new URL (url , "interceptorStage/foo" ), HttpMethod .POST );
150
150
req .setAdditionalHeader ("Content-Type" ,"application/json" );
151
151
req .setRequestBody ("{x:3,y:5}" );
152
152
TextPage p = wc .getPage (req );
@@ -163,7 +163,7 @@ public void testInterceptorStageContentTypeWithCharset() throws Exception {
163
163
assertEquals (404 , e .getStatusCode ());
164
164
}
165
165
166
- WebRequestSettings req = new WebRequestSettings (new URL (url , "interceptorStage/foo" ), HttpMethod .POST );
166
+ WebRequest req = new WebRequest (new URL (url , "interceptorStage/foo" ), HttpMethod .POST );
167
167
req .setAdditionalHeader ("Content-Type" ,"application/json; charset=utf-8" );
168
168
req .setRequestBody ("{x:3,y:5}" );
169
169
TextPage p = wc .getPage (req );
@@ -227,7 +227,7 @@ public void testPutInheritance() throws Exception {
227
227
WebClient wc = new WebClient ();
228
228
229
229
// the request should get to the overriding method and it should still see all the annotations in the base type
230
- WebRequestSettings wrs = new WebRequestSettings (new URL (url , "putInheritance/foo" ), HttpMethod .PUT );
230
+ WebRequest wrs = new WebRequest (new URL (url , "putInheritance/foo" ), HttpMethod .PUT );
231
231
wrs .setRequestBody ("Hello" );
232
232
TextPage p = wc .getPage (wrs );
233
233
assertEquals ("Hello World!" , p .getContent ());
@@ -241,7 +241,7 @@ public void testPutInheritance() throws Exception {
241
241
}
242
242
243
243
//Invoke Post as well
244
- wrs = new WebRequestSettings (new URL (url , "putInheritance/acme" ), HttpMethod .POST );
244
+ wrs = new WebRequest (new URL (url , "putInheritance/acme" ), HttpMethod .POST );
245
245
wrs .setRequestBody ("Hello" );
246
246
p = wc .getPage (wrs );
247
247
assertEquals ("POST: Hello" , p .getContent ());
@@ -255,14 +255,14 @@ public void testInterfaceMethods() throws Exception {
255
255
} catch (FailingHttpStatusCodeException x ) {
256
256
assertEquals (HttpServletResponse .SC_METHOD_NOT_ALLOWED , x .getStatusCode ());
257
257
}
258
- assertEquals ("default" , wc .getPage (new WebRequestSettings (new URL (url , "usesInterfaceMethods/foo" ), HttpMethod .POST )).getWebResponse ().getContentAsString ().trim ());
258
+ assertEquals ("default" , wc .getPage (new WebRequest (new URL (url , "usesInterfaceMethods/foo" ), HttpMethod .POST )).getWebResponse ().getContentAsString ().trim ());
259
259
try {
260
260
wc .getPage (new URL (url , "overridesInterfaceMethods/foo" ));
261
261
fail ();
262
262
} catch (FailingHttpStatusCodeException x ) {
263
263
assertEquals (HttpServletResponse .SC_METHOD_NOT_ALLOWED , x .getStatusCode ());
264
264
}
265
- assertEquals ("due to UnionAnnotatedElement it is even inherited" , "overridden" , wc .getPage (new WebRequestSettings (new URL (url , "overridesInterfaceMethods/foo" ), HttpMethod .POST )).getWebResponse ().getContentAsString ().trim ());
265
+ assertEquals ("due to UnionAnnotatedElement it is even inherited" , "overridden" , wc .getPage (new WebRequest (new URL (url , "overridesInterfaceMethods/foo" ), HttpMethod .POST )).getWebResponse ().getContentAsString ().trim ());
266
266
}
267
267
public interface InterfaceWithWebMethods {
268
268
@ RequirePOST
@@ -309,7 +309,7 @@ public void testRequirePostOnBase() throws Exception {
309
309
}
310
310
311
311
// POST should succeed
312
- wc .getPage (new WebRequestSettings (url , HttpMethod .POST ));
312
+ wc .getPage (new WebRequest (url , HttpMethod .POST ));
313
313
assertEquals (1 , requirePostOnBase .hit );
314
314
}
315
315
0 commit comments