Module openflax.http.response

HTTP response generation for OpenFlax.

Description

HTTP response generation for OpenFlax.

This module exports functions which are called exclusively from openflax.serve to send an HTTP response back to the user agent via the HTTP service.

Function Index

error/4Returns an error response.
moved/4Returns a redirection response (typically 301 or 302) to the user agent via the HTTP service.
send_data/3Sends arbitrary text or data to the HTTP service.
send_headers/2Sends an HTTP response header through the HTTP service.

Function Details

error/4

error(Http::http(), Conf::conf(), Response::response(), MasterDict::master_dict()) -> {ok, conf()}

Returns an error response. If an error-handling module is configured, serve_error/3 will attempt to use it to generate an error response page. Otherwise, a (very plain) stock response is offered.

moved/4

moved(Http::http(), Conf::conf(), Response::response(), URI::uri()) -> {ok, conf()} | {error, Reason}

Returns a redirection response (typically 301 or 302) to the user agent via the HTTP service.

send_data/3

send_data(Http::http(), Conf::conf(), Data::string()) -> ok | {error, Reason}

Sends arbitrary text or data to the HTTP service. Sends nothing if the Request-Method was HEAD.

send_headers/2

send_headers(Http::http(), Conf::conf()) -> ok | {error, Reason}

Sends an HTTP response header through the HTTP service. Note that after doing this, you should not send any body if the Request-Method is HEAD.