You are not logged in.
Pages: 1
Any hint how to add Response Header from MVCApplication.
context := ServiceRunningContext;
context.Request.Call^.OutHead := context.Request.Call^.OutHead + #13#10 + 'Test: test';
Trying this code from MVCApplication method, mORMot2/FPC, don't return Test Header.
I'm playing with htmx for client side (htmx.org) and need to trigger some events on client with response header.
https://htmx.org/docs/#requests
I need to send response header from mvc controller depending of business logic in mvc method.
Offline
I have just added a new "CustomOutHttpHeader" optional value, to be added to the MVC method context, which will be used to set the HTTP output headers.
Offline
Thanks @ab, this will solve the problem.
Can you please at line 1740 add
if head<>'' then
fOutput.Header := fOutput.Header + #13#10 + head;
In case when CustomOutHttpHeader := '' mvc application raise exception:
{ "errorCode":500, "errorText":"Unsafe HTTP header rejected [Content-Type: text/html; charset=UTF-8$0d$0a$0d$0aETag: \"57A6E6D8\"]" }
In same method depend of business logic I insert none, one or many response headers.
Offline
Please check https://github.com/synopse/mORMot2/commit/17d2f4cb
Offline
Pages: 1