An open API service indexing awesome lists of open source software.

https://github.com/tbdsux/reqgo

A simple wrapper for go http requests
https://github.com/tbdsux/reqgo

go go-http go-requests golang http-requests requests

Last synced: 28 days ago
JSON representation

A simple wrapper for go http requests

Awesome Lists containing this project

README

          

# reqgo

A simple wrapper for http requests

> Library is very much incomplete, its only purpose is for handling basic / normal http requests. Please use the default `net/http` package for more complex and control over the request

## Install

```sh
go get -u github.com/tbdsux/reqgo
```

## Usage

API is based from python's `requests` module and node's `fetch` api.

```go
package main

import (
"fmt"
"log"

"github.com/tbdsux/reqgo"
)

func main() {
r, err := reqgo.Get("https://httpbin.org/get", &reqgo.Options{
Headers: reqgo.Headers{
"Custom-Header": "hello world",
},
})

if err != nil {
log.Fatalln(err)
}

var data map[string]interface{}
if err := r.JSON(&data); err != nil {
log.Fatalln(err)
}

fmt.Println(data["headers"])
}

```

##

**© 2023 | tbdsux**