Add: httpx
parent
196eb315df
commit
fe62b1d0d7
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.ifooth.com/common/pkg/httpx"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client := httpx.C()
|
||||
resp, err := client.R().Get("https://ifooth.com")
|
||||
fmt.Println(resp, err)
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package httpx
|
||||
|
||||
import "net/http"
|
||||
|
||||
// Request :
|
||||
type Request struct {
|
||||
raw *http.Request
|
||||
}
|
||||
|
||||
// Get :
|
||||
func (r *Request) Get(u string) (*Response, error) {
|
||||
return &Response{raw: &http.Response{}}, nil
|
||||
}
|
||||
|
||||
// Response :
|
||||
type Response struct {
|
||||
raw *http.Response
|
||||
}
|
||||
|
||||
// Client :
|
||||
type Client struct {
|
||||
raw *http.Client
|
||||
}
|
||||
|
||||
// R :
|
||||
func (c *Client) R() *Request {
|
||||
return &Request{raw: &http.Request{}}
|
||||
}
|
||||
|
||||
// C :
|
||||
func C() *Client {
|
||||
return &Client{raw: &http.Client{}}
|
||||
}
|
Loading…
Reference in New Issue