Gateway.Send & HttpResult

What is the correct function return type and IReturnType if I have two service implementations,

the “core” one does this:

return new HttpResult(new FileInfo(filePath), asAttachment:true);

the “outer” one does this:

return Gateway.Send(new innerServiceDto());

I want the outer one to push a file to the browser as well, but was not able to get it to work. I tried IReturn<byte[]> with no luck. Inner one works as expected, outer one does not send the file to the browser.

The HttpResult with asAttachment:true sets a bunch of file associated response headers that impacts how the browser responds. Your Gateway (which one are you using?) will likely have its own IRequest and response instance separate from the outer request which will be why your client (browser) behaves differently.

You will likely need to control this yourself on the outer request, setting the associated response headers and MimeType for the outer IRequest.Response, or your IServiceGateway will need to detect and replicate related headers.

If you can share more of your implementation, that would help to replicate and could provide more details/options.

Only the response body can be returned through the Service Gateway, your outer Service would need to return the decorated HttpResult itself.

Thank you- understood -

Basically if you need to return a decorated Response you would need to go back to using ResolveService to call APIs explicitly, e.g:

using var innerService = base.ResolveService<InnerService>();
return innerService.Any(new InnerRequest());