http package renamed to client to reduce cunfusion

This commit is contained in:
Musab Gültekin
2019-06-29 14:18:31 +03:00
parent 1e109c555d
commit bd6466a5f2
8 changed files with 73 additions and 73 deletions

30
client/request.go Normal file
View File

@ -0,0 +1,30 @@
package client
import (
"io"
"net/http"
)
// Request is a small wrapper around *http.Request that contains Metadata and Rendering option
type Request struct {
*http.Request
Meta map[string]interface{}
Synchronized bool
Rendered bool
Cancelled bool
}
// Cancel request
func (r *Request) Cancel() {
r.Cancelled = true
}
// NewRequest returns a new Request given a method, URL, and optional body.
func NewRequest(method, url string, body io.Reader) (*Request, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
return &Request{Request: req}, nil
}