mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-07 18:14:03 +00:00
Add Nextcloud Talk support (#1167)
Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
197
vendor/github.com/monaco-io/request/README.md
generated
vendored
Normal file
197
vendor/github.com/monaco-io/request/README.md
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
# Request [](https://github.com/avelino/awesome-go) [](https://goreportcard.com/report/github.com/monaco-io/request) 
|
||||
|
||||
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
|
||||
|
||||
[](https://travis-ci.org/monaco-io/request)
|
||||
[](https://pkg.go.dev/github.com/monaco-io/request?tab=doc)
|
||||
[](https://codecov.io/gh/monaco-io/request)
|
||||
[](https://github.com/monaco-io/request/releases)
|
||||
[](https://www.tickgit.com/browse?repo=github.com/monaco-io/request)
|
||||
[](https://github.com/monaco-io/request/blob/master/LICENSE)
|
||||
<!-- [](https://sourcegraph.com/github.com/monaco-io/request?badge) -->
|
||||
<!-- [](https://www.codetriage.com/monaco-io/request) -->
|
||||
<!-- [](https://gitter.im/monaco-io/request?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -->
|
||||
|
||||
HTTP client for golang, Inspired by [Javascript-axios](https://github.com/axios/axios) [Python-request](https://github.com/psf/requests).
|
||||
If you have experience about axios or requests, you will love it.
|
||||
No 3rd dependency.
|
||||
|
||||
## Features
|
||||
|
||||
- Make [http](https://golang.org) requests from Golang
|
||||
- Intercept request and response
|
||||
- Transform request and response data
|
||||
|
||||
## Installing
|
||||
|
||||
go mod:
|
||||
|
||||
```bash
|
||||
go get github.com/monaco-io/request
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
- OPTIONS
|
||||
- GET
|
||||
- HEAD
|
||||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- TRACE
|
||||
- CONNECT
|
||||
|
||||
## Example
|
||||
|
||||
### GET
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Method: "GET",
|
||||
Params: map[string]string{"hello": "world"},
|
||||
}
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
### POST
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Method: "POST",
|
||||
Params: map[string]string{"hello": "world"},
|
||||
Body: []byte(`{"hello": "world"}`),
|
||||
}
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
### Content-Type
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Method: "POST",
|
||||
ContentType: request.ApplicationXWwwFormURLEncoded, // default is "application/json"
|
||||
}
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
### Authorization
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Method: "POST",
|
||||
BasicAuth: request.BasicAuth{
|
||||
Username:"user_xxx",
|
||||
Password:"pwd_xxx",
|
||||
}, // xxx:xxx
|
||||
}
|
||||
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
### Timeout
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Method: "POST",
|
||||
Timeout: 10, // seconds
|
||||
}
|
||||
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
### Cookies
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/monaco-io/request"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := request.Client{
|
||||
URL: "https://google.com",
|
||||
Cookies:[]*http.Cookie{
|
||||
{
|
||||
Name: "cookie_name",
|
||||
Value: "cookie_value",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := client.Do()
|
||||
|
||||
log.Println(resp.Code, string(resp.Data), err)
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
Reference in New Issue
Block a user