Skip to content

Commit 91f876a

Browse files
committed
Applying PR review suggestions
1 parent 37bf5a9 commit 91f876a

File tree

1 file changed

+5
-3
lines changed
  • opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http

1 file changed

+5
-3
lines changed

opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http/OkHttpSender.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public static OkHttpSender create(String url, OkHttpClient client) {
2929
return new OkHttpSender(url, client);
3030
}
3131

32+
private static final String CONTENT_TYPE = "application/x-protobuf";
33+
private static final MediaType MEDIA_TYPE = MediaType.parse(CONTENT_TYPE);
34+
3235
private OkHttpSender(String url, OkHttpClient client) {
3336
this.url = url;
3437
this.client = client;
@@ -38,10 +41,9 @@ private OkHttpSender(String url, OkHttpClient client) {
3841
public CompletableFuture<Response> send(Consumer<OutputStream> writer, int contentLength) {
3942
CompletableFuture<Response> future = new CompletableFuture<>();
4043
okhttp3.Request.Builder builder = new okhttp3.Request.Builder().url(url);
41-
String contentType = "application/x-protobuf";
42-
builder.addHeader("Content-Type", contentType);
44+
builder.addHeader("Content-Type", CONTENT_TYPE);
4345

44-
RequestBody body = new RawRequestBody(writer, contentLength, MediaType.parse(contentType));
46+
RequestBody body = new RawRequestBody(writer, contentLength, MEDIA_TYPE);
4547
builder.post(body);
4648

4749
try {

0 commit comments

Comments
 (0)