<commit_before>Note: This is a work in progress and not totally support all specifications.
Right now, you can only do simple get and post with easy to specify header like in examples

GoRequest
=========

GoRequest -- Simplified HTTP client ( inspired by famous SuperAgent lib in Node.js )

## Installation

```
$ go get github.com/parnurzeal/gorequest
```

## Why should you use GoRequest?

GoRequest makes thing much more simple for you, making http client more awesome and fun like SuperAgent + golang style usage.

This is what you normally do for a simple GET without GoRequest:

```
resp, err := http.Get("http://example.com/")
```

With GoRequest:

```
resp, body, err := gorequest.Get("http://example.com/").End()
```

How about getting control over HTTP client headers, redirect policy, and etc. Things is getting more complicated in golang. You need to create a Client, setting header in different comamnd, ... to do just only one __GET__

```
client := &http.Client{
  CheckRedirect: redirectPolicyFunc,
}

req, err := http.NewRequest("GET", "http://example.com", nil)

req.Header.Add("If-None-Match", `W/"wyzzy"`)
resp, err := client.Do(req)
```

Why making things ugly while you can just do as follows:

```
### policy is not supported yet
resp, body, err := gorequest.Get("http://example.com").
  Set("If-None-Match", `W/"wyzzy"`).
  End()
```

For __a JSON POST__, you might need to marshal map data to json format, setting header to 'application/json' and declare http.Client with standard library. So, you code might look like:

```
m := map[string]interface{}{
  "value1": "one",
  "value2": "two",
}
mJson, _ := json.Marshal(m)
contentReader := bytes.NewReader(mJson)
req, _ := http.NewRequest("POST", "http://requestb.in/1kovd3s1", contentReader)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
```


<commit_msg>Updated README for Post()<commit_after>Note: This is a work in progress and not totally support all specifications.
Right now, you can only do simple get and post with easy to specify header like in examples

GoRequest
=========

GoRequest -- Simplified HTTP client ( inspired by famous SuperAgent lib in Node.js )

## Installation

```
$ go get github.com/parnurzeal/gorequest
```

## Why should you use GoRequest?

GoRequest makes thing much more simple for you, making http client more awesome and fun like SuperAgent + golang style usage.

This is what you normally do for a simple GET without GoRequest:

```
resp, err := http.Get("http://example.com/")
```

With GoRequest:

```
resp, err := gorequest.Get("http://example.com/").End()
```

How about getting control over HTTP client headers, redirect policy, and etc. Things is getting more complicated in golang. You need to create a Client, setting header in different comamnd, ... to do just only one __GET__

```
client := &http.Client{
  CheckRedirect: redirectPolicyFunc,
}

req, err := http.NewRequest("GET", "http://example.com", nil)

req.Header.Add("If-None-Match", `W/"wyzzy"`)
resp, err := client.Do(req)
```

Why making things ugly while you can just do as follows:

```
### policy is not supported yet
resp, err := gorequest.Get("http://example.com").
  Set("If-None-Match", `W/"wyzzy"`).
  End()
```

For __a JSON POST__, you might need to marshal map data structure to json format, setting header to 'application/json' (and other headers if you need to) and declare http.Client with standard library. So, you code become longer and hard to maintain:

```
m := map[string]interface{}{
  "name": "backy",
  "species": "dog",
}
mJson, _ := json.Marshal(m)
contentReader := bytes.NewReader(mJson)
req, _ := http.NewRequest("POST", "http://example.com", contentReader)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Warning","gorequest/is/coming")
client := &http.Client{}
resp, _ := client.Do(req)
```

Compared to our gorequest version, JSON is for sure a default. So, it turns to be just one simple line!:

```
gorequest.Post("http://example.com").
  Set("Warning","gorequst/is/coming").
  Send(`{"name":"backy", "species":"dog"}`).
  End()
```

{'fraction_non_alphanumeric': 0.14431239388794567, 'fraction_numerical': 0.001212709192335678, 'mean_word_length': 4.498666666666667, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1581354', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1249, 'n_words': 470}