-module(datastar@ds_wisp). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -define(FILEPATH, "src/datastar/ds_wisp.gleam"). -export([send/2]). -file("src/datastar/ds_wisp.gleam", 4). -spec send( gleam@http@response:response(wisp:body()), list(datastar@ds_sse:event()) ) -> gleam@http@response:response(wisp:body()). send(Response, Events) -> Body = datastar@ds_sse: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>> ).