优化插件的参数请求

This commit is contained in:
Yun
2024-01-01 14:10:18 +08:00
parent c7c03ab1d3
commit 5159d5d258
6 changed files with 238 additions and 102 deletions
-41
View File
@@ -1,46 +1,5 @@
package curlx
type FieldType string
const (
FieldTypeFile FieldType = "file"
FieldTypeText FieldType = "text"
)
type FormParam struct {
FieldName string `json:"field_name"` // 字段名
FieldValue string `json:"field_value"` // 字段值
FieldType FieldType `json:"field_type"` // 动作(file/text)
FileName string `json:"file_name"` // 文件名
FileBytes []byte `json:"file_bytes"` // 文件内容
}
type ContentType string
const (
ContentTypeForm ContentType = "multipart/form-data"
ContentTypeJson ContentType = "application/json"
ContentTypeXml ContentType = "application/xml"
ContentTypeText ContentType = "text/plain"
ContentTypeUrlEncoded ContentType = "application/x-www-form-urlencoded"
)
type method string
const (
MethodGet method = "GET"
MethodPost method = "POST"
)
type CurlParams struct {
Url string
Method method // GET/POST
Params interface{}
Headers map[string]interface{}
Cookies interface{}
ContentType ContentType // FORM,JSON,XML
}
type UserAgent string