Skip to content

Commit

Permalink
docs: add docs for new client
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneWerner87 committed May 12, 2024
1 parent 6220990 commit e2f60ac
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
22 changes: 10 additions & 12 deletions docs/client/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ description: >-
sidebar_position: 1
---

# Client

The Fiber Client is a powerful HTTP client optimized for high performance and ease of use in server-side applications. Built on top of the robust FastHTTP library, it inherits FastHTTP's high-speed HTTP protocol implementation. The client is designed to make HTTP requests both internally within services or externally to other web services.

## Features
Expand Down Expand Up @@ -690,20 +688,20 @@ Reset clears the Client object
func (c *Client) Reset()
```

# Default Client
## Default Client

Default client is default client object of Gofiber and created using `New()`.
You can configurate it as you wish or replace it with another clients.

## C
### C

C gets default client.

```go title="Signature"
func C()
```

## Replace
### Replace

Replace the defaultClient, the returned function can undo.

Expand All @@ -715,55 +713,55 @@ The default client should not be changed concurrently.
func Replace()
```

## Get
### Get

Get send a get request use defaultClient, a convenient method.

```go title="Signature"
func Get(url string, cfg ...Config) (*Response, error)
```

## Post
### Post

Post send a post request use defaultClient, a convenient method.

```go title="Signature"
func Post(url string, cfg ...Config) (*Response, error)
```

## Head
### Head

Head send a head request use defaultClient, a convenient method.

```go title="Signature"
func Head(url string, cfg ...Config) (*Response, error)
```

## Put
### Put

Put send a put request use defaultClient, a convenient method.

```go title="Signature"
func Put(url string, cfg ...Config) (*Response, error)
```

## Delete
### Delete

Delete send a delete request use defaultClient, a convenient method.

```go title="Signature"
func Delete(url string, cfg ...Config) (*Response, error)
```

## Options
### Options

Options send a options request use defaultClient, a convenient method.

```go title="Signature"
func Options(url string, cfg ...Config) (*Response, error)
```

## Patch
### Patch

Patch send a patch request use defaultClient, a convenient method.

Expand Down
17 changes: 10 additions & 7 deletions docs/client/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
id: examples
title: 🍳 Examples
description: >-
Some useful examples about the client.
Some useful examples about the client.
sidebar_position: 5
---

# Basic Auth
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Basic Auth

<Tabs>
<TabItem value="client" label="Client">
Expand Down Expand Up @@ -68,7 +71,7 @@ func main() {
</TabItem>
</Tabs>

# TLS
## TLS

<Tabs>
<TabItem value="client" label="Client">
Expand Down Expand Up @@ -140,9 +143,9 @@ func main() {
</TabItem>
</Tabs>

# Cookiejar
## Cookiejar

## Request
### Request

```go
func main() {
Expand All @@ -166,7 +169,7 @@ func main() {
<details>
<summary>Click here to see the result</summary>

```
```json
{
"cookies": {
"john": "doe"
Expand All @@ -176,7 +179,7 @@ func main() {
</details>


## Response
### Response

```go
func main() {
Expand Down
4 changes: 2 additions & 2 deletions docs/client/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ With hooks, you can manipulate the client on before request/after response stage

There are 2 kinds of hooks:

# Request Hooks
## Request Hooks

They are called before the HTTP request has been sent. You can use them make changes on Request object.

Expand Down Expand Up @@ -119,7 +119,7 @@ exit status 2
```
</details>

# Response Hooks
## Response Hooks

They are called after the HTTP response has been completed. You can use them to get some information about response and request.

Expand Down
2 changes: 0 additions & 2 deletions docs/client/request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ description: >-
sidebar_position: 2
---

# Request

The `Request` structure in Gofiber's HTTP client represents an HTTP request. It encapsulates all the necessary information required to send a request to a server. This includes:

- **URL**: The URL to which the request is sent.
Expand Down
2 changes: 0 additions & 2 deletions docs/client/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ description: >-
sidebar_position: 3
---

# Response

The `Response` structure in Gofiber's HTTP client represents the server's response to an HTTP request. It contains all the necessary information received from the server. This includes:

- **Status Code**: The HTTP status code returned by the server (e.g., 200 OK, 404 Not Found).
Expand Down

0 comments on commit e2f60ac

Please sign in to comment.