$req->respond ({ content => ['text/plain', sub { my ($data_cb) = @_; # 200 / text/plain already sent to client by now... # do async io that eventually calls the call back... myPromise()->then(sub{ $data_cb->("OK"); # Too late to change content-type or status code here.. $data_cb->(); })->catch(sub{ $data_cb->("Failed"); # Or here... $data_cb->(); }); } });