diff --git a/README.md b/README.md index 346d3ff..1a0074b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Add the following folders to your project, in *Project > Options > Resource Comp ## Getting Started You need to use RESTRequest4D.Request.Intf and RESTRequest4D.Request ```pascal -uses RESTRequest4D.Request.Intf, RESTRequest4D.Request; +uses RESTRequest4D.Request; ``` #### Method @@ -64,13 +64,19 @@ In the `GetFullRequestURL` method the parameter indicates whether to add the par #### Body -You can assign the request body with different types of parameters (strings, JSON and objects). To clear the body of a request, simply use `Request.Body.Clear`. The second parameter indicates who is responsible for destroying the object. Default is `True`. See the samples: +You can assign the request body with different types of parameters (strings, JSON and objects). To clear the body of a request, simply use `Request.Body.Clear` or `Request.ClearBody`. The second parameter indicates who is responsible for destroying the object. Default is `True`. See the samples: ```pascal begin Request.Body.Add('Any thing'); - Request.Body.Add(TJSONObject.Create, True); - Request.Body.Add(TObject.Create, True); + Request.Body.Add(TJSONObject.Create); + Request.Body.Add(TObject.Create); + + // or + + Request.AddBody('Any thing'); + Request.AddBody(TJSONObject.Create); + Request.AddBody(TObject.Create); end; ``` @@ -96,11 +102,13 @@ end; #### Headers -You can add headers. To clear the headers, use the `Request.Headers.Clear`. When you add a headers with the same name, its value changes. See the samples: +You can add headers. To clear the headers, use the `Request.Headers.Clear` or `Request.ClearHeaders`. When you add a headers with the same name, its value changes. See the samples: ```pascal begin Request.Headers.Add('Accept-Encoding', 'gzip'); + // or + Request.AddHeader('Accept-Encoding', 'gzip'); end; ``` @@ -130,7 +138,9 @@ Here's an example of how to add the token generated by JWT in your request. To g ```pascal begin - Request.Params.AddHeader('Authorization', 'JWT Token', [poDoNotEncode]); + Request.Headers.Add('Authorization', 'JWT Token', [poDoNotEncode]); + // or + Request.AddHeader('Authorization', 'JWT Token', [poDoNotEncode]); end; ``` @@ -141,6 +151,11 @@ The Execute method will return the Status code. See more in [**HTTP Status Codes ```pascal begin Request.Execute; + // or + Request.Get; + Request.Post; + Request.Put; + Request.Delete; end; ```