use of com.artipie.http.headers.Accept in project artipie by artipie.
the class PromuSlice method response.
@Override
public Response response(final String line, final Iterable<Map.Entry<String, String>> headers, final Publisher<ByteBuffer> body) {
final String ctype = new Accept(headers).values().get(0);
try (StringWriter writer = new StringWriter()) {
final MetricsOutput output = new PrometheusOutput(writer, ctype, new HashSet<>(new RqParams(new RequestLineFrom(line).uri()).values("name")));
this.metrics.publish(output);
return new RsFull(RsStatus.OK, new Headers.From(new ContentType(ctype)), new Content.From(writer.toString().getBytes(StandardCharsets.UTF_8)));
} catch (final IOException ioe) {
throw new ArtipieIOException(ioe);
}
}
Aggregations