-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_test.go
More file actions
209 lines (204 loc) · 5.32 KB
/
Copy patherrors_test.go
File metadata and controls
209 lines (204 loc) · 5.32 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
package fasthttp
import "testing"
func TestExportedErrorStrings(t *testing.T) {
t.Parallel()
tests := []struct {
name string
err error
want string
}{
{
name: "ErrAlreadyServing",
err: ErrAlreadyServing,
want: "fasthttp: server is already serving connections",
},
{
name: "ErrMissingFile",
err: ErrMissingFile,
want: "fasthttp: there is no uploaded file associated with the given key",
},
{
name: "ErrPerIPConnLimit",
err: ErrPerIPConnLimit,
want: "fasthttp: too many connections per ip",
},
{
name: "ErrConcurrencyLimit",
err: ErrConcurrencyLimit,
want: "fasthttp: cannot serve the connection because server.concurrency concurrent connections are served",
},
{
name: "ErrBadTrailer",
err: ErrBadTrailer,
want: "fasthttp: contain forbidden trailer",
},
{
name: "ErrReadingResponseHeaders",
err: ErrReadingResponseHeaders,
want: "fasthttp: error when reading response headers",
},
{
name: "ErrReadingResponseTrailer",
err: ErrReadingResponseTrailer,
want: "fasthttp: error when reading response trailer",
},
{
name: "ErrResponseFirstLineMissingSpace",
err: ErrResponseFirstLineMissingSpace,
want: "fasthttp: cannot find whitespace in the first line of response",
},
{
name: "ErrUnexpectedStatusCodeChar",
err: ErrUnexpectedStatusCodeChar,
want: "fasthttp: unexpected char at the end of status code",
},
{
name: "ErrMissingRequestMethod",
err: ErrMissingRequestMethod,
want: "fasthttp: cannot find http request method",
},
{
name: "ErrUnsupportedRequestMethod",
err: ErrUnsupportedRequestMethod,
want: "fasthttp: unsupported http request method",
},
{
name: "ErrExtraWhitespaceInRequestLine",
err: ErrExtraWhitespaceInRequestLine,
want: "fasthttp: extra whitespace in request line",
},
{
name: "ErrEmptyRequestURI",
err: ErrEmptyRequestURI,
want: "fasthttp: requesturi cannot be empty",
},
{
name: "ErrDuplicateContentLength",
err: ErrDuplicateContentLength,
want: "fasthttp: duplicate content-length header",
},
{
name: "ErrUnsupportedTransferEncoding",
err: ErrUnsupportedTransferEncoding,
want: "fasthttp: unsupported transfer-encoding",
},
{
name: "ErrNonNumericChars",
err: ErrNonNumericChars,
want: "fasthttp: non-numeric chars found",
},
{
name: "ErrNeedMore",
err: ErrNeedMore,
want: "fasthttp: need more data: cannot find trailing lf",
},
{
name: "ErrSmallReadBuffer",
err: ErrSmallReadBuffer,
want: "fasthttp: small read buffer. increase readbuffersize",
},
{
name: "ErrNoArgValue",
err: ErrNoArgValue,
want: "fasthttp: no args value for the given key",
},
{
name: "ErrorInvalidURI",
err: ErrorInvalidURI,
want: "fasthttp: invalid uri",
},
{
name: "ErrDialTimeout",
err: ErrDialTimeout,
want: "fasthttp: dialing to the given tcp address timed out",
},
{
name: "ErrContentEncodingUnsupported",
err: ErrContentEncodingUnsupported,
want: "fasthttp: unsupported content-encoding",
},
{
name: "ErrNoMultipartForm",
err: ErrNoMultipartForm,
want: "fasthttp: request content-type has bad boundary or is not multipart/form-data",
},
{
name: "ErrGetOnly",
err: ErrGetOnly,
want: "fasthttp: non-get request received",
},
{
name: "ErrBodyTooLarge",
err: ErrBodyTooLarge,
want: "fasthttp: body size exceeds the given limit",
},
{
name: "ErrNoCookies",
err: ErrNoCookies,
want: "fasthttp: no cookies found",
},
{
name: "ErrInvalidCookieValue",
err: ErrInvalidCookieValue,
want: "fasthttp: invalid cookie value",
},
{
name: "ErrNoAvailableClients",
err: ErrNoAvailableClients,
want: "fasthttp: no available clients",
},
{
name: "ErrMissingLocation",
err: ErrMissingLocation,
want: "fasthttp: missing location header for http redirect",
},
{
name: "ErrTooManyRedirects",
err: ErrTooManyRedirects,
want: "fasthttp: too many redirects detected when doing the request",
},
{
name: "ErrHostClientRedirectToDifferentScheme",
err: ErrHostClientRedirectToDifferentScheme,
want: "fasthttp: hostclient can't follow redirects to a different protocol, please use client instead",
},
{
name: "ErrNoFreeConns",
err: ErrNoFreeConns,
want: "fasthttp: no free connections available to host",
},
{
name: "ErrConnectionClosed",
err: ErrConnectionClosed,
want: "fasthttp: the server closed connection before returning the first response byte. make sure the server returns 'connection: close' response header before closing the connection",
},
{
name: "ErrConnPoolStrategyNotImpl",
err: ErrConnPoolStrategyNotImpl,
want: "fasthttp: connection pool strategy is not implement",
},
{
name: "ErrTimeout",
err: ErrTimeout,
want: "fasthttp: timeout",
},
{
name: "ErrTLSHandshakeTimeout",
err: ErrTLSHandshakeTimeout,
want: "fasthttp: tls handshake timed out",
},
{
name: "ErrPipelineOverflow",
err: ErrPipelineOverflow,
want: "fasthttp: pipelined requests' queue has been overflowed. increase maxconns and/or maxpendingrequests",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := tt.err.Error(); got != tt.want {
t.Fatalf("unexpected error string:\ngot %q\nwant %q", got, tt.want)
}
})
}
}