FnRequestHandler extends
	SimpleRequestHandler<FnRequestHandler.WrappedInput, FnRequestHandler.WrappedOutput> { @Override protected SimpleResponseWriter<WrappedOutput> createResponseWriter(WrappedInput wrappedInput) { return new ResponseWriter(); }  @Override JRestlessContainerRequest createContainerRequest(WrappedInput wrappedInput); RequestAndBaseUri getRequestAndBaseUri(InputEvent inputEvent); @FnConfiguration void setRuntimeContext(RuntimeContext rctx); final OutputEvent handleRequest(InputEvent inputEvent);  }
@Test public void testResponseWriter_WithoutContentHeader_ShouldDefaultToApplicationJson() throws IOException { Map<String, List<String>> headers = new HashMap<>(); SimpleRequestHandler.SimpleResponseWriter<FnRequestHandler.WrappedOutput> responseWriter = requestHandler.createResponseWriter(null); responseWriter.writeResponse(Response.Status.OK, headers, new ByteArrayOutputStream()); Assert.assertTrue(responseWriter.getResponse().getOutputEvent().getContentType().get().equals(MediaType.APPLICATION_JSON)); }
@Test public void testResponseWriter_WithContentHeader_ShouldUseContentHeaderGiven() throws IOException { Map<String, List<String>> headers = new HashMap<>(); headers.put("Content-Type", Collections.singletonList(MediaType.TEXT_HTML)); SimpleRequestHandler.SimpleResponseWriter<FnRequestHandler.WrappedOutput> responseWriter = requestHandler.createResponseWriter(null); responseWriter.writeResponse(Response.Status.OK, headers, new ByteArrayOutputStream()); Assert.assertTrue(responseWriter.getResponse().getOutputEvent().getContentType().get().equals(MediaType.TEXT_HTML)); }