-
Notifications
You must be signed in to change notification settings - Fork 6
/
constants.go
130 lines (89 loc) · 3.79 KB
/
constants.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package fetch
import "errors"
// HEAD is request method HEAD
const HEAD = "HEAD"
// GET is request method GET
const GET = "GET"
// POST is request method POST
const POST = "POST"
// PUT is request method PUT
const PUT = "PUT"
// DELETE is request method DELETE
const DELETE = "DELETE"
// PATCH is request method PATCH
const PATCH = "PATCH"
// METHODS is the list of supported methods
var METHODS = []string{
HEAD,
GET,
POST,
PUT,
DELETE,
PATCH,
}
// // headers.ContentType is the content type header name
// const headers.ContentType = "Content-Type"
// // headers.Accept is the accept header name
// const headers.Accept = "Accept"
// // headers.Referrer is the referrer header name
// const headers.Referrer = "Referer"
// // headers.UserAgent ...
// const headers.UserAgent = "User-Agent"
// // headers.Authorization ...
// const headers.Authorization = "Authorization"
// // headers.CacheControl ...
// const headers.CacheControl = "Cache-Control"
// // headers.AcceptEncoding ...
// const headers.AcceptEncoding = "Accept-Encoding"
// // headers.AcceptLanguage ...
// const headers.AcceptLanguage = "Accept-Language"
// // headers.Cookie ...
// const headers.Cookie = "Cookie"
// // headers.Location ...
// const headers.Location = "Location"
// // headers.ContentLength ...
// const headers.ContentLength = "Content-Length"
// // headers.ContentEncoding ...
// const headers.ContentEncoding = "Content-Encoding"
// // headers.TransferEncoding ...
// const headers.TransferEncoding = "Transfer-Encoding"
// // headers.ContentLanguage ...
// const headers.ContentLanguage = "Content-Language"
// // headers.SetCookie ...
// const headers.SetCookie = "Set-Cookie"
// // headers.XPoweredBy ...
// const headers.XPoweredBy = "X-Powered-By"
// // headers.XRequestID ...
// const headers.XRequestID = "X-Request-ID"
// // headers.AcceptRanges ...
// const headers.AcceptRanges = "Accept-Ranges"
// EnvDEBUG is the DEBUG env name
const EnvDEBUG = "GO_ZOOX_FETCH_DEBUG"
// ErrTooManyArguments is the error when the number of arguments is too many
var ErrTooManyArguments = errors.New("too many arguments")
// ErrInvalidMethod is the error when the method is invalid
var ErrInvalidMethod = errors.New("invalid method")
// ErrCannotCreateRequest is the error when the request cannot be created
var ErrCannotCreateRequest = errors.New("cannot create request")
// ErrCannotSendBodyWithGet is the error when the body cannot be sent with GET method
var ErrCannotSendBodyWithGet = errors.New("cannot send body with GET method")
// ErrInvalidJSONBody is the error when the body is not a valid JSON
var ErrInvalidJSONBody = errors.New("error marshalling body")
// ErrSendingRequest is the error when the request cannot be sent
var ErrSendingRequest = errors.New("error sending request")
// ErrReadingResponse is the error when the response cannot be read
var ErrReadingResponse = errors.New("error reading response")
// ErrInvalidContentType is the error when the content type is invalid
var ErrInvalidContentType = errors.New("invalid content type")
// ErrorInvalidBody is the error when the body is invalid
var ErrorInvalidBody = errors.New("invalid body")
// ErrInvalidBodyMultipart is the error when the body is invalid for multipart
var ErrInvalidBodyMultipart = errors.New("invalid body multipart")
// ErrCannotCreateFormFile is the error when the form file cannot be created
var ErrCannotCreateFormFile = errors.New("cannot create form file")
// ErrCannotCopyFile is the error when the file cannot be copied
var ErrCannotCopyFile = errors.New("cannot copy file")
// ErrInvalidURLFormEncodedBody is the error when the body is invalid for url form encoded
var ErrInvalidURLFormEncodedBody = errors.New("invalid url form encoded body")
// ErrCookieEmptyKey is the error when the key is empty
var ErrCookieEmptyKey = errors.New("empty key")