Coverage Summary for Class: ApiUtil (com.github.malyshevhen.api)
Class |
Class, %
|
Method, %
|
Line, %
|
ApiUtil |
0%
(0/1)
|
0%
(0/2)
|
0%
(0/7)
|
package com.github.malyshevhen.api;
import org.springframework.web.context.request.NativeWebRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ApiUtil {
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
try {
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
res.setCharacterEncoding("UTF-8");
res.addHeader("Content-Type", contentType);
res.getWriter().print(example);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}