Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciussanchez authored May 27, 2020
1 parent 19aff40 commit d3f39a5
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
```

Expand All @@ -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;
```

Expand Down Expand Up @@ -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;
```

Expand All @@ -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;
```

Expand Down

0 comments on commit d3f39a5

Please sign in to comment.