RespondWithHeaders
Allows the use of WithHeaders in the return type. Must be the top level type, unless used with KrosstalkResult, in which case it may be on the second level.
Headers returned in the WithHeaders object on the server side will be added to the HTTP response. On the client side, the returned WithHeaders object will have the headers from the HTTP response, (usually) including those set in the server's returned WithHeaders. Note that most header sending implementations use case-insensitive names, so if you return {"My-Header": "Value"}
you may get "my-header": "Value"
on the client.
If your return type is WithHeaders<KrosstalkResult<>>
, the response headers you return in the server function will only be set on success. However, the return value on the client will still have the headers of any error responses.