diff --git a/boss-lock.json b/boss-lock.json index 2df73ea..0a3e09d 100644 --- a/boss-lock.json +++ b/boss-lock.json @@ -1,14 +1,14 @@ { "hash": "37cdf91cb63badb018c3de5698104f56", - "updated": "2019-08-29T21:18:11.080448-03:00", + "updated": "2021-01-12T16:49:00.3150989-03:00", "installedModules": { "github.com/hashload/horse": { "name": "horse", - "version": "2.0.6", - "hash": "f2d5c64f23435568e5b3e68b5fe927c4", + "version": "2.0.8", + "hash": "f0d9be7d8b5059a6e99397562d39306c", "artifacts": {}, "failed": false, "changed": false } } -} +} \ No newline at end of file diff --git a/boss.json b/boss.json index 65e6910..af6aa89 100644 --- a/boss.json +++ b/boss.json @@ -6,6 +6,6 @@ "mainsrc": "src/", "projects": [], "dependencies": { - "github.com/HashLoad/horse": "^2.0.6" + "github.com/HashLoad/horse": "^2.0.8" } -} +} \ No newline at end of file diff --git a/jhonson.dproj b/jhonson.dproj index 76f6691..52bb051 100644 --- a/jhonson.dproj +++ b/jhonson.dproj @@ -48,7 +48,7 @@ All true jhonson - C:\Users\hunsc\projects\hashload\jhonson\modules\horse\src\;modules\.dcp;modules\.dcu;modules;modules\horse\src;$(DCC_UnitSearchPath) + C:\Users\hunsc\projects\hashload\jhonson\modules\horse\src\;$(DCC_UnitSearchPath);modules\.dcp;modules\.dcu;modules;modules\horse\src Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) diff --git a/samples/delphi/Samples.dproj b/samples/delphi/Samples.dproj index 92dbf84..0c1d99a 100644 --- a/samples/delphi/Samples.dproj +++ b/samples/delphi/Samples.dproj @@ -156,20 +156,12 @@ classes 1 - - classes - 1 - res\xml 1 - - res\xml - 1 - @@ -182,10 +174,6 @@ library\lib\armeabi 1 - - library\lib\armeabi - 1 - @@ -198,20 +186,12 @@ library\lib\mips 1 - - library\lib\mips - 1 - library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - @@ -224,200 +204,120 @@ res\drawable 1 - - res\drawable - 1 - res\values 1 - - res\values - 1 - res\values-v21 1 - - res\values-v21 - 1 - res\values 1 - - res\values - 1 - res\drawable 1 - - res\drawable - 1 - res\drawable-xxhdpi 1 - - res\drawable-xxhdpi - 1 - res\drawable-ldpi 1 - - res\drawable-ldpi - 1 - res\drawable-mdpi 1 - - res\drawable-mdpi - 1 - res\drawable-hdpi 1 - - res\drawable-hdpi - 1 - res\drawable-xhdpi 1 - - res\drawable-xhdpi - 1 - res\drawable-mdpi 1 - - res\drawable-mdpi - 1 - res\drawable-hdpi 1 - - res\drawable-hdpi - 1 - res\drawable-xhdpi 1 - - res\drawable-xhdpi - 1 - res\drawable-xxhdpi 1 - - res\drawable-xxhdpi - 1 - res\drawable-xxxhdpi 1 - - res\drawable-xxxhdpi - 1 - res\drawable-small 1 - - res\drawable-small - 1 - res\drawable-normal 1 - - res\drawable-normal - 1 - res\drawable-large 1 - - res\drawable-large - 1 - res\drawable-xlarge 1 - - res\drawable-xlarge - 1 - res\values 1 - - res\values - 1 - @@ -506,9 +406,6 @@ 0 - - 0 - 0 @@ -798,9 +695,6 @@ 1 - - 1 - @@ -893,10 +787,6 @@ library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - 1 diff --git a/samples/delphi/boss-lock.json b/samples/delphi/boss-lock.json index a3dafde..ce060cb 100644 --- a/samples/delphi/boss-lock.json +++ b/samples/delphi/boss-lock.json @@ -1,11 +1,11 @@ { - "hash": "d41d8cd98f00b204e9800998ecf8427e", - "updated": "2020-09-03T22:43:09.5243365-03:00", + "hash": "6ef9161b900632671022358216c7dfe7", + "updated": "2021-01-12T16:50:20.409138-03:00", "installedModules": { "github.com/hashload/horse": { "name": "horse", - "version": "v2.0.3", - "hash": "fb7144725ff788c49af1307f97f23b5a", + "version": "2.0.8", + "hash": "f0d9be7d8b5059a6e99397562d39306c", "artifacts": {}, "failed": false, "changed": false diff --git a/samples/delphi/boss.json b/samples/delphi/boss.json index abdb9dd..f820d8f 100644 --- a/samples/delphi/boss.json +++ b/samples/delphi/boss.json @@ -6,6 +6,6 @@ "mainsrc": "src", "projects": [], "dependencies": { - "github.com/hashload/horse": "^v2.0.0" + "github.com/hashload/horse": "^v2.0.8" } } \ No newline at end of file diff --git a/src/Horse.Jhonson.pas b/src/Horse.Jhonson.pas index e1b4810..9c7dd28 100644 --- a/src/Horse.Jhonson.pas +++ b/src/Horse.Jhonson.pas @@ -37,33 +37,25 @@ function Jhonson(const ACharset: string): THorseCallback; overload; procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED(FPC)}TNextProc{$ELSE}TProc{$ENDIF}); var - LWebRequest: {$IF DEFINED(FPC)}TRequest{$ELSE}TWebRequest{$ENDIF}; - LWebResponse: {$IF DEFINED(FPC)}TResponse{$ELSE}TWebResponse{$ENDIF}; - LContent: TObject; LJSON: {$IF DEFINED(FPC)}TJsonData{$ELSE}TJSONValue{$ENDIF}; begin - LWebRequest := THorseHackRequest(Req).GetWebRequest; - if ({$IF DEFINED(FPC)} StringCommandToMethodType(LWebRequest.Method) - {$ELSE} LWebRequest.MethodType{$ENDIF} in [mtPost, mtPut]) and (LWebRequest.ContentType = 'application/json') then + {$ELSE} Req.RawWebRequest.MethodType{$ENDIF} in [mtPost, mtPut]) and (Req.RawWebRequest.ContentType = 'application/json') then begin LJSON := {$IF DEFINED(FPC)} GetJSON(Req.Body) {$ELSE}TJSONObject.ParseJSONValue(Req.Body){$ENDIF}; - THorseHackRequest(Req).SetBody(LJSON); + Req.Body(LJSON); end; try Next; finally - LWebResponse := THorseHackResponse(Res).GetWebResponse; - LContent := THorseHackResponse(Res).GetContent; - - if Assigned(LContent) and LContent.InheritsFrom({$IF DEFINED(FPC)}TJsonData{$ELSE}TJSONValue{$ENDIF}) then + if (Res.Content <> nil) and Res.Content.InheritsFrom({$IF DEFINED(FPC)}TJsonData{$ELSE}TJSONValue{$ENDIF}) then begin {$IF DEFINED(FPC)} LWebResponse.ContentStream := TStringStream.Create(TJsonData(LContent).AsJSON); {$ELSE} - LWebResponse.Content := {$IF CompilerVersion > 27.0}TJSONValue(LContent).ToJSON{$ELSE}TJSONValue(LContent).ToString{$ENDIF}; + Res.RawWebResponse.Content := {$IF CompilerVersion > 27.0}TJSONValue(Res.Content).ToJSON{$ELSE}TJSONValue(LContent).ToString{$ENDIF}; {$ENDIF} - LWebResponse.ContentType := 'application/json; charset=' + Charset; + Res.RawWebResponse.ContentType := 'application/json; charset=' + Charset; end; end; end;