mirror of
https://github.com/rclone/rclone.git
synced 2024-12-11 19:53:46 +08:00
29 lines
807 B
Go
29 lines
807 B
Go
package src
|
|
|
|
// HTTPRequest struct
|
|
type HTTPRequest struct {
|
|
Method string
|
|
Path string
|
|
Parameters map[string]interface{}
|
|
Headers map[string][]string
|
|
}
|
|
|
|
func createGetRequest(client *Client, path string, params map[string]interface{}) *HTTPRequest {
|
|
return createRequest(client, "GET", path, params)
|
|
}
|
|
|
|
func createPostRequest(client *Client, path string, params map[string]interface{}) *HTTPRequest {
|
|
return createRequest(client, "POST", path, params)
|
|
}
|
|
|
|
func createRequest(client *Client, method string, path string, parameters map[string]interface{}) *HTTPRequest {
|
|
var headers = make(map[string][]string)
|
|
headers["Authorization"] = []string{"OAuth " + client.token}
|
|
return &HTTPRequest{
|
|
Method: method,
|
|
Path: path,
|
|
Parameters: parameters,
|
|
Headers: headers,
|
|
}
|
|
}
|