// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.yahoo.container.jdisc.HttpResponse;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Optional;

/**
 * @author valerijf
 */
public class ProxyResponse extends HttpResponse {

    private final String content;
    private final String contentType;

    public ProxyResponse(String content, String contentType, int status) {
        super(status);
        this.content = content;
        this.contentType = contentType;
    }

    @Override
    public void render(OutputStream outputStream) throws IOException {
        outputStream.write(content.getBytes(StandardCharsets.UTF_8));
    }

    @Override
    public String getContentType() {
        return Optional.ofNullable(contentType).orElseGet(super::getContentType);
    }
}

@@ -280,50 +280,8 @@
 am;%0A
-import java.nio.charset.StandardCharsets;%0A
 impo
@@ -303,16 +303,16 @@
 tional;%0A
+
 %0A/**%0A * 
@@ -393,38 +393,38 @@
   private final 
-String
+byte%5B%5D
  content;%0A    pr
@@ -481,22 +481,22 @@
 esponse(
-String
+byte%5B%5D
  content
@@ -718,16 +718,16 @@
 ption %7B%0A
+
         
@@ -756,41 +756,8 @@
 tent
-.getBytes(StandardCharsets.UTF_8)
 );%0A 

Use byte array for proxy response