We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d39e015 commit 1ec832bCopy full SHA for 1ec832b
1 file changed
modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache
@@ -21,9 +21,11 @@ public class ApiUtil {
21
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
22
try {
23
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
24
- res.setCharacterEncoding("UTF-8");
25
- res.addHeader("Content-Type", contentType);
26
- res.getWriter().print(example);
+ if (res != null) {
+ res.setCharacterEncoding("UTF-8");
+ res.addHeader("Content-Type", contentType);
27
+ res.getWriter().print(example);
28
+ }
29
} catch (IOException e) {
30
throw new RuntimeException(e);
31
}
0 commit comments