use of com.couchbase.client.core.deps.io.netty.handler.codec.http.HttpMethod in project couchbase-jvm-clients by couchbase.
the class CoreAnalyticsLinkManager method sendLink.
private CompletableFuture<Void> sendLink(HttpMethod method, Map<String, String> link, CoreCommonOptions options, String tracingId) {
// ensure mutability, and don't modify caller's map
link = new HashMap<>(link);
CoreHttpPath path = getLinkPathAndAdjustMap(link);
UrlQueryStringBuilder form = newForm();
link.forEach(form::set);
return httpClient.newRequest(method, path, options).trace(tracingId).form(form).exec(core).exceptionally(t -> {
throw translateCompilationFailureToInvalidArgument(t);
}).thenApply(result -> null);
}
use of com.couchbase.client.core.deps.io.netty.handler.codec.http.HttpMethod in project couchbase-jvm-clients by couchbase.
the class ViewRequest method encode.
@Override
public FullHttpRequest encode() {
StringBuilder path = new StringBuilder();
path.append("/").append(bucket).append("/_design/");
path.append(development ? "dev_" + design : design);
path.append("/_view/");
path.append(view);
path.append("?").append(query);
ByteBuf content = keysJson.isPresent() ? Unpooled.copiedBuffer(keysJson.get()) : Unpooled.EMPTY_BUFFER;
HttpMethod method = keysJson.isPresent() ? HttpMethod.POST : HttpMethod.GET;
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, path.toString(), content);
request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON).set(HttpHeaderNames.CONTENT_LENGTH, content.readableBytes()).set(HttpHeaderNames.USER_AGENT, context().environment().userAgent().formattedLong());
authenticator.authHttpRequest(serviceType(), request);
return request;
}
Aggregations