Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Jan 8, 2015
1 parent ed8ed19 commit 1c35dc3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,30 @@ request
Go HTTP Requests for Humans™. Inspired by [Python-Requests](https://github.com/kennethreitz/requests).


Installation
------------

```
go get -u github.com/mozillazg/request
```


Documentation
--------------

API documentation can be found here:
https://godoc.org/github.com/mozillazg/request


Usage
-------

```go
import (
"github.com/mozillazg/request"
)
```

**GET**:

```go
Expand Down
17 changes: 17 additions & 0 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,20 @@ func TestPostFiles(t *testing.T) {
_, x = d.Get("files").CheckGet("test")
assert.Equal(t, x, true)
}

func TestGzip(t *testing.T) {
c := &http.Client{}
a := NewArgs(c)
url := "http://httpbin.org/gzip"
resp, _ := Get(url, a)
d, _ := resp.Json()
t2, _ := resp.Text()
c2, _ := resp.Content()
defer resp.Body.Close()

assert.Equal(t, resp.Reason() != "", true)
assert.Equal(t, resp.OK(), true)
assert.Equal(t, t2 != "", true)
assert.Equal(t, c2 != nil, true)
assert.Equal(t, d.Get("gzipped").MustBool(), true)
}

0 comments on commit 1c35dc3

Please sign in to comment.