use of com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest in project couchbase-jvm-clients by couchbase.
the class CoreHttpRequest method encode.
@Override
public FullHttpRequest encode() {
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, pathAndQueryString(), content);
request.headers().add(headers);
context().authenticator().authHttpRequest(serviceType(), request);
return request;
}
use of com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest in project couchbase-jvm-clients by couchbase.
the class QueryRequest method encode.
@Override
public FullHttpRequest encode() {
ByteBuf content = Unpooled.wrappedBuffer(query);
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, URI, content);
request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON);
request.headers().set(HttpHeaderNames.CONTENT_LENGTH, content.readableBytes());
request.headers().set(HttpHeaderNames.USER_AGENT, context().environment().userAgent().formattedLong());
authenticator.authHttpRequest(serviceType(), request);
return request;
}
use of com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest in project couchbase-jvm-clients by couchbase.
the class RawManagerIntegrationTest method canAddCustomHeader.
@Test
void canAddCustomHeader() {
RawManagerRequest request = RawManagerRequest.get(ServiceType.MANAGER, "/pools");
RawManagerOptions options = RawManagerOptions.rawManagerOptions().httpHeader("Accept", "text/html");
Cluster clusterMock = mock(Cluster.class);
Core core = mock(Core.class);
when(clusterMock.environment()).thenReturn(cluster.environment());
when(clusterMock.core()).thenReturn(core);
when(core.context()).thenReturn(cluster.core().context());
RawManager.call(clusterMock, request, options);
ArgumentCaptor<GenericManagerRequest> captor = ArgumentCaptor.forClass(GenericManagerRequest.class);
verify(core, times(1)).send(captor.capture());
FullHttpRequest encoded = captor.getValue().encode();
assertEquals(encoded.headers().get("Accept"), "text/html");
}
use of com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest in project couchbase-jvm-clients by couchbase.
the class BucketConfigRequest method encode.
@Override
public FullHttpRequest encode() {
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, String.format(PATH, bucketName));
authenticator.authHttpRequest(serviceType(), request);
return request;
}
Aggregations