Skip to content

Commit

Permalink
use correct linebreaks in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
broothie committed Apr 7, 2023
1 parent b2317d2 commit 9fa6aa6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ A list of all available options can be found [here](https://pkg.go.dev/github.co
## Usage

`qst` uses an options pattern to build `*http.Request` objects:

```go
request, err := qst.NewPatch("https://breakfast.com/api", // New PATCH request
qst.BearerAuth("c0rNfl@k3s"), // Authorization header
Expand All @@ -30,9 +31,8 @@ request, err := qst.NewPatch("https://breakfast.com/api", // New PATCH request
)
```

Documentation for all available options can be found [here](https://pkg.go.dev/github.com/broothie/qst#Option).

It can also be used to fire requests:

```go
request, err := qst.Patch("https://breakfast.com/api", // Send PATCH request
qst.BearerAuth("c0rNfl@k3s"), // Authorization header
Expand All @@ -42,6 +42,7 @@ request, err := qst.Patch("https://breakfast.com/api", // Send PATCH request
```

The options pattern makes it easy to define custom options:

```go
func createdSinceYesterday() qst.Option {
return qst.QueryValue("created_at", fmt.Sprintf(">=%s", time.Now().Add(-24 * time.Hour).Format(time.RFC3339)))
Expand Down Expand Up @@ -79,6 +80,7 @@ response, err := client.Patch(
### qst.OptionFunc

`OptionFunc` can be used to add a custom function which is run during request creation:

```go
client := qst.NewClient(http.DefaultClient,
qst.OptionFunc(func(request *http.Request) (*http.Request, error) {
Expand Down

0 comments on commit 9fa6aa6

Please sign in to comment.