-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.go
34 lines (26 loc) · 826 Bytes
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package requests
import (
"github.com/sari3l/requests/types"
)
func Get(url string, ext ...types.Ext) *Response {
return initRequest("GET", url, &ext).request()
}
func Post(url string, ext ...types.Ext) *Response {
return initRequest("POST", url, &ext).request()
}
func Put(url string, ext ...types.Ext) *Response {
return initRequest("PUT", url, &ext).request()
}
func Delete(url string, ext ...types.Ext) *Response {
return initRequest("DELETE", url, &ext).request()
}
func Head(url string, ext ...types.Ext) *Response {
return initRequest("HEAD", url, &ext).request()
}
func Options(url string, ext ...types.Ext) *Response {
return initRequest("OPTIONS", url, &ext).request()
}
func initRequest(method string, url string, exts *[]types.Ext) *Session {
s := HTMLSession()
return s.init(method, url, exts)
}