Java Code Examples for org.openqa.selenium.remote.http.HttpMethod#GET
The following examples show how to use
org.openqa.selenium.remote.http.HttpMethod#GET .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractHttpCommandCodec.java From selenium with Apache License 2.0 | 5 votes |
@Override public HttpRequest encode(Command command) { String name = aliases.getOrDefault(command.getName(), command.getName()); CommandSpec spec = nameToSpec.get(name); if (spec == null) { throw new UnsupportedCommandException(command.getName()); } Map<String, ?> parameters = amendParameters(command.getName(), command.getParameters()); String uri = buildUri(name, command.getSessionId(), parameters, spec); HttpRequest request = new HttpRequest(spec.method, uri); if (HttpMethod.POST == spec.method) { String content = json.toJson(parameters); byte[] data = content.getBytes(UTF_8); request.setHeader(CONTENT_LENGTH, String.valueOf(data.length)); request.setHeader(CONTENT_TYPE, JSON_UTF_8.toString()); request.setContent(bytes(data)); } if (HttpMethod.GET == spec.method) { request.setHeader(CACHE_CONTROL, "no-cache"); } return request; }
Example 2
Source File: ReverseProxyHandlerTest.java From selenium with Apache License 2.0 | 5 votes |
@Test public void shouldForwardRequestsToEndPoint() { HttpHandler handler = new ReverseProxyHandler(tracer, factory.createClient(server.url)); HttpRequest req = new HttpRequest(HttpMethod.GET, "/ok"); req.addHeader("X-Cheese", "Cake"); handler.execute(req); // HTTP headers are case insensitive. This is how the HttpUrlConnection likes to encode things assertEquals("Cake", server.lastRequest.getHeader("x-cheese")); }
Example 3
Source File: AbstractHttpCommandCodec.java From selenium with Apache License 2.0 | 4 votes |
protected static CommandSpec get(String path) { return new CommandSpec(HttpMethod.GET, path); }
Example 4
Source File: MobileCommand.java From java-client with Apache License 2.0 | 2 votes |
/** * This methods forms GET commands. * * @param url is the command URL * @return an instance of {@link org.openqa.selenium.remote.CommandInfo} */ public static AppiumCommandInfo getC(String url) { return new AppiumCommandInfo(url, HttpMethod.GET); }