Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problema com o Res.SendFile, usando THorse.Get('*', function) #366

Open
renanfrancisodasilva opened this issue Dec 7, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@renanfrancisodasilva
Copy link

renanfrancisodasilva commented Dec 7, 2023

Boa tarde,

Em meu servidor possuo um endpoin registrado assim:
THorse.Get('*', captura_arquivo);

O captura_arquivo:

        try
          LStream := TFileStream.Create(ApplicationPath+'horse.pdf', fmOpenRead);
          Res.SendFile(LStream, 'horse.pdf', 'application/pdf').Status(200);

        finally
          try
            FreeAndNil(LStream);
          except on E: Exception do
          end;
        end;

Oque ocorre, se o endpoint tiver sido registrao como "*" o SendFile não funciona.
Porém se chamar o mesmo captura_arquivo através de um endpoint com um nome:
THorse.Get('arquivo', captura_arquivo);

O arquivo é exibido normalmente no navegador

@viniciussanchez viniciussanchez added the bug Something isn't working label Dec 11, 2023
@viniciussanchez viniciussanchez moved this to Todo in Horse Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants