Skip to content

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

@renanfrancisodasilva

Description

@renanfrancisodasilva

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions