-module(datastar_wisp). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([send/2]). -file("src/datastar_wisp.gleam", 4). -spec send(gleam@http@response:response(wisp:body()), list(datastar:event())) -> gleam@http@response:response(wisp:body()). send(Response, Events) -> Body = datastar:events_to_string(Events), _pipe = Response, _pipe@1 = wisp:string_body(_pipe, Body), _pipe@2 = fun gleam@http@response:set_header/3( _pipe@1, <<"Cache-Control"/utf8>>, <<"no-cache"/utf8>> ), fun gleam@http@response:set_header/3( _pipe@2, <<"Content-Type"/utf8>>, <<"text/event-stream"/utf8>> ).