use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class OAuth2AuthenticationHandlerTest method shouldNotHandleRequest_invalidAuthorizationHeader.
@Test
public void shouldNotHandleRequest_invalidAuthorizationHeader() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, "");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertFalse(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class TransactionHandlerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(request.headers()).thenReturn(new HttpHeaders());
when(response.headers()).thenReturn(new HttpHeaders());
when(request.metrics()).thenReturn(Metrics.on(System.currentTimeMillis()).build());
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class ApiKeyAuthenticationHandlerTest method shouldNotHandleRequest.
@Test
public void shouldNotHandleRequest() {
Request request = mock(Request.class);
when(request.headers()).thenReturn(new HttpHeaders());
MultiValueMap<String, String> parameters = mock(MultiValueMap.class);
when(request.parameters()).thenReturn(parameters);
boolean handle = authenticationHandler.canHandle(request);
Assert.assertFalse(handle);
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class VertxProxyConnection method writeHeaders.
private void writeHeaders() {
HttpHeaders headers = proxyRequest.headers();
// Copy headers to upstream
headers.forEach(httpClientRequest::putHeader);
// Check chunk flag on the request if there are some content to push and if transfer_encoding is set
// with chunk value
long contentLength = headers.contentLength();
if (contentLength > 0 || headers.contentType() != null) {
if (contentLength == -1) {
// No content-length... so let's go for chunked transfer-encoding
httpClientRequest.setChunked(true);
}
}
headersWritten = true;
}
use of io.gravitee.common.http.HttpHeaders in project gravitee-gateway by gravitee-io.
the class JWTAuthenticationHandlerTest method shouldNotHandleRequest_noBearerAuthorizationHeader.
@Test
public void shouldNotHandleRequest_noBearerAuthorizationHeader() {
HttpHeaders headers = new HttpHeaders();
Request request = mock(Request.class);
when(request.headers()).thenReturn(headers);
headers.add(HttpHeaders.AUTHORIZATION, "Basic xxx-xx-xxx-xx-xx");
boolean handle = authenticationHandler.canHandle(request);
Assert.assertFalse(handle);
}
Aggregations