/** * Sets the response content type, this will override the default content type of the output * * @param contentType a mime type for the response */ default void setResponseContentType(String contentType) { this.setResponseHeader(OutputEvent.CONTENT_TYPE_HEADER, contentType); }
@Override public void setStatusCode(int code) { if (code < 100 || code >= 600) { throw new IllegalArgumentException("Invalid HTTP status code: " + code); } invocationContext.setResponseHeader("Fn-Http-Status", "" + code); } }
@Override public void setResponseHeader(String key, String value, String... vs) { if (Headers.canonicalKey(key).equals(OutputEvent.CONTENT_TYPE_HEADER)) { invocationContext.setResponseContentType(value); invocationContext.setResponseHeader("Fn-Http-H-" + key, value); } else { invocationContext.setResponseHeader("Fn-Http-H-" + key, value, vs); } }