Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for Set and AppendHeader in README.md, issue 159 #171

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,31 @@ gorequest.New().Post("http://example.com/").

Check the docs for `SendFile` to get more information about the types of arguments.

## Headers

When setting one header to the request, the `Set` method can be used:

```go
gorequest.New().
Post("/gamelist").
Set("Accept", "application/json").
End()
```

This will clear all headers currently attached to a request and add the specified header.

If there are multiple headers that must be appended to the request before sending, use `AppendHeader`. These can be chained together to add additional headers to the request:

```go
gorequest.New().
Post("/gamelist").
AppendHeader("Accept", "application/json").
AppendHeader("Accept", "text/plain").
End()
```

See the docs for the `Set` and `AppendHeader` methods for information about parameter and return types.

## Proxy

In the case when you are behind proxy, GoRequest can handle it easily with Proxy func:
Expand Down