@Override public String method(HttpServerRequest request) { return request.rawMethod(); }
@Override public void handle(Void aVoid) { if (!finished.compareAndSet(false, true)) return; VertxHttpServerAdapter.setCurrentMethodAndPath( context.request().rawMethod(), context.currentRoute().getPath() ); try { serverHandler.handleSend(context.response(), context.failure(), span); } finally { VertxHttpServerAdapter.setCurrentMethodAndPath(null, null); } } }
@Test public void testOtherMethodRequest() throws Exception { server.requestHandler(r -> { assertEquals(HttpMethod.OTHER, r.method()); assertEquals("COPY", r.rawMethod()); r.response().end(); }).listen(onSuccess(s -> { client.request(HttpMethod.OTHER, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath", resp -> { testComplete(); }).setRawMethod("COPY").end(); })); await(); }
@Override public String rawMethod() { return httpServerRequest.rawMethod(); }
@Override public String rawMethod() { return delegate.rawMethod(); }
@Test public void testPartialH2CAmbiguousRequest() throws Exception { server.requestHandler(req -> { assertEquals("POST", req.rawMethod()); testComplete(); }); Buffer fullRequest = Buffer.buffer("POST /whatever HTTP/1.1\r\n\r\n"); startServer(); NetClient client = vertx.createNetClient(); client.connect(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, onSuccess(so -> { so.write(fullRequest.slice(0, 1)); vertx.setTimer(1000, id -> { so.write(fullRequest.slice(1, fullRequest.length())); }); })); await(); }
HttpServerResponse response = mock(HttpServerResponse.class); when(request.method()).thenReturn(HttpMethod.GET); when(request.rawMethod()).thenReturn("GET"); when(request.uri()).thenReturn("http://localhost/path"); when(request.absoluteURI()).thenReturn("http://localhost/path");
@Override public String rawMethod() { return request.rawMethod(); }
@Override public String rawMethod() { return delegate.rawMethod(); }
/** * @return the HTTP method as sent by the client */ public String rawMethod() { String ret = delegate.rawMethod(); return ret; }
@Override public String rawMethod() { return httpServerRequest.rawMethod(); }
/** * @return the HTTP method as sent by the client */ public String rawMethod() { String ret = delegate.rawMethod(); return ret; }
@Override public String rawMethod() { return request.rawMethod(); }
@Test public void testOtherMethodRequest() throws Exception { server.requestHandler(r -> { assertEquals(HttpMethod.OTHER, r.method()); assertEquals("COPY", r.rawMethod()); r.response().end(); }).listen(onSuccess(s -> { client.request(HttpMethod.OTHER, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, "/somepath", resp -> { testComplete(); }).setRawMethod("COPY").end(); })); await(); }
@Test public void testPartialH2CAmbiguousRequest() throws Exception { server.requestHandler(req -> { assertEquals("POST", req.rawMethod()); testComplete(); }); Buffer fullRequest = Buffer.buffer("POST /whatever HTTP/1.1\r\n\r\n"); startServer(); NetClient client = vertx.createNetClient(); client.connect(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, onSuccess(so -> { so.write(fullRequest.slice(0, 1)); vertx.setTimer(1000, id -> { so.write(fullRequest.slice(1, fullRequest.length())); }); })); await(); }
HttpServerResponse response = request.response(); VertxHttpResponse vertxResponse = new VertxHttpResponse(response, dispatcher.getProviderFactory(), request.method()); VertxHttpRequest vertxRequest = new VertxHttpRequest(ctx, headers, uriInfo, request.rawMethod(), dispatcher.getDispatcher(), vertxResponse, false); if (buff.length() > 0)
public ProxyRequestImpl(HttpClient client, SocketAddress target, HttpServerRequest request) { this(req -> { HttpMethod method = req.method(); HttpClientRequest backRequest = client.request(method, target.port(), target.host(), req.uri()); if (method == HttpMethod.OTHER) { backRequest.setRawMethod(req.rawMethod()); } return backRequest; }, request); }
@Test public void testRawMethod(TestContext ctx) throws Exception { Async latch = ctx.async(); SocketAddress backend = startHttpBackend(ctx, 8081, req -> { ctx.assertEquals(HttpMethod.OTHER, req.method()); ctx.assertEquals("FOO", req.rawMethod()); req.response().end(); }); startProxy(backend); HttpClient client = vertx.createHttpClient(); client.request(HttpMethod.OTHER, 8080, "localhost", "/", resp -> latch.complete()).setRawMethod("FOO").end(); }
ctx.request().headers().set(XOkapiHeaders.REQUEST_IP, ctx.request().remoteAddress().host()); ctx.request().headers().set(XOkapiHeaders.REQUEST_TIMESTAMP, "" + System.currentTimeMillis()); ctx.request().headers().set(XOkapiHeaders.REQUEST_METHOD, ctx.request().rawMethod());
HttpServerResponse response = request.response(); VertxHttpResponse vertxResponse = new VertxHttpResponse(response, dispatcher.getProviderFactory(), request.method()); VertxHttpRequest vertxRequest = new VertxHttpRequest(ctx, headers, uriInfo, request.rawMethod(), dispatcher.getDispatcher(), vertxResponse, false); if (buff.length() > 0)