Packages

An easy to use, high performance framework to quickly build APIs for the Gleam programming language

Current section

Files

Jump to
glace src glace@internal@glace_response.erl
Raw

src/glace@internal@glace_response.erl

-module(glace@internal@glace_response).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([html/2, text/2, json/2, not_found/0]).
-file("/home/ram/code/gleam/glace/src/glace/internal/glace_response.gleam", 5).
-spec html(binary(), integer()) -> gleam@http@response:response(mist:response_data()).
html(Input, Status) ->
_pipe = gleam@http@response:new(Status),
_pipe@1 = gleam@http@response:set_body(
_pipe,
{bytes, gleam_stdlib:wrap_list(Input)}
),
gleam@http@response:set_header(
_pipe@1,
<<"content-type"/utf8>>,
<<"text/html"/utf8>>
).
-file("/home/ram/code/gleam/glace/src/glace/internal/glace_response.gleam", 11).
-spec text(binary(), integer()) -> gleam@http@response:response(mist:response_data()).
text(Input, Status) ->
_pipe = gleam@http@response:new(Status),
_pipe@1 = gleam@http@response:set_body(
_pipe,
{bytes, gleam_stdlib:wrap_list(Input)}
),
gleam@http@response:set_header(
_pipe@1,
<<"content-type"/utf8>>,
<<"text/plain"/utf8>>
).
-file("/home/ram/code/gleam/glace/src/glace/internal/glace_response.gleam", 17).
-spec json(binary(), integer()) -> gleam@http@response:response(mist:response_data()).
json(Input, Status) ->
_pipe = gleam@http@response:new(Status),
_pipe@1 = gleam@http@response:set_body(
_pipe,
{bytes, gleam_stdlib:wrap_list(Input)}
),
gleam@http@response:set_header(
_pipe@1,
<<"content-type"/utf8>>,
<<"application/json"/utf8>>
).
-file("/home/ram/code/gleam/glace/src/glace/internal/glace_response.gleam", 23).
-spec not_found() -> gleam@http@response:response(mist:response_data()).
not_found() ->
_pipe = gleam@http@response:new(404),
_pipe@1 = gleam@http@response:set_body(
_pipe,
{bytes, gleam_stdlib:wrap_list(<<""/utf8>>)}
),
gleam@http@response:set_header(
_pipe@1,
<<"content-type"/utf8>>,
<<"text/plain"/utf8>>
).