File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
opamp-client/src/main/java/io/opentelemetry/opamp/client/internal/connectivity/http Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments