mirror of https://github.com/gofiber/fiber.git
parent
239e36e0f6
commit
3ab3d151c7
|
@ -268,10 +268,10 @@ agent.BodyStream(strings.NewReader("body=stream"), -1)
|
|||
|
||||
### JSON
|
||||
|
||||
JSON sends a JSON request by setting the Content-Type header to `application/json`.
|
||||
JSON sends a JSON request by setting the Content-Type header to the `ctype` parameter. If no `ctype` is passed in, the header is set to `application/json`.
|
||||
|
||||
```go title="Signature"
|
||||
func (a *Agent) JSON(v interface{}) *Agent
|
||||
func (a *Agent) JSON(v interface{}, ctype ...string) *Agent
|
||||
```
|
||||
|
||||
```go title="Example"
|
||||
|
|
|
@ -797,7 +797,7 @@ app.Get("/", func(c *fiber.Ctx) error {
|
|||
Converts any **interface** or **string** to JSON using the [encoding/json](https://pkg.go.dev/encoding/json) package.
|
||||
|
||||
:::info
|
||||
JSON also sets the content header to the `ctype` parameter. If no `ctype` is passed in, the header is set to **application/json**.
|
||||
JSON also sets the content header to the `ctype` parameter. If no `ctype` is passed in, the header is set to `application/json`.
|
||||
:::
|
||||
|
||||
```go title="Signature"
|
||||
|
|
Loading…
Reference in New Issue