Skip to content

3.0.2

Compare
Choose a tag to compare
@viniciussanchez viniciussanchez released this 05 Jul 17:22
· 101 commits to master since this release

Horse 3.0.2

  • f6cbe82 Suporte ao LHS Brackets
    LHS Brackets support

Example: http://localhost:9000/ping?test[eq]=1234&test[lt]=321&test[ne]=111

procedure GetPing(Req: THorseRequest; Res: THorseResponse);
var
  LPong: TJSONArray;
  LLhsBracketType: TLhsBracketsType;
  LJson: TJSONObject;
begin
  THorseCoreParamConfig.GetInstance.CheckLhsBrackets(True);

  LPong := TJSONArray.Create;
  for LLhsBracketType in Req.Query.Field('test').LhsBrackets.Types do
  begin
    LJson := TJSONObject.Create;
    LJson.Add(Format('test %s =', [LLhsBracketType.ToString]) , Req.Query.Field('test').LhsBrackets.GetValue(LLhsBracketType));
    LPong.Add(LJson);
  end;

  Res.Send(LPong.AsJSON);
end;
  • f3650b7 Opção para pegar o ContentField como Stream
    Option to get ContentField as Stream
Req.ContentFields.Field('paramName').AsStream;
  • 6777a47 Opção para salvar ContentField como arquivo
    Option to save ContentField as file
Req.ContentFields.Field('paramName').SaveToFile('C:\file.txt');
  • 9a11717 Possibilidade de adicionar um Header sem acessar o RawWebResponse
    Possibility to add a Header without accessing RawWebResponse
// before
Res.RawWebResponse.SetCustomHeader('', '');

// after
Res.AddHeader('', '');
  • c415c52 Possibilidade de passar apenas os parâmetros necessários no callback dos endpoints no Lazarus
    Possibility to pass only the necessary parameters in the callback of the endpoints in Lazarus
procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
begin
  Res.Send('Req, Res, Next');
end;

procedure GetPing1(Req: THorseRequest; Res: THorseResponse);
begin
  Res.Send('Req, Res');
end;

procedure GetPing2(Req: THorseRequest);
begin
  WriteLn('Req');
end;

begin
  THorse.Get('/ping', GetPing);
  THorse.Get('/ping1', GetPing1);
  THorse.Get('/ping2', GetPing2);

  THorse.Listen(9000);
end.
  • 81ef2b6 Método "All" (Equivale a todos os verbos HTTP)
    "All" method (Equivalent to all HTTP verbs)
THorse.All('/users', DoUsers);
  • b4151dd Novos métodos de retorno
    New return methods
Res.SendFile('E:\temp\foto.jpg');
Res.Download('E:\temp\foto.jpg');
Res.Render('E:\Temp\Client.html');
  • 🔺 edfc02c Correção da falha no SkipRoutes dos middlewares Basic Auth e JWT
    Fixed SkipRoutes crash in Basic Auth and JWT middleware