-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathresponse.go
More file actions
32 lines (26 loc) · 747 Bytes
/
response.go
File metadata and controls
32 lines (26 loc) · 747 Bytes
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
package documentdb
import (
"math"
"net/http"
)
type Response struct {
Header http.Header
}
// Continuation returns continuation token for paged request.
// Pass this value to next request to get next page of documents.
func (r *Response) Continuation() string {
return r.Header.Get(HeaderContinuation)
}
type statusCodeValidatorFunc func(statusCode int) bool
func expectStatusCode(expected int) statusCodeValidatorFunc {
return func(statusCode int) bool {
return expected == statusCode
}
}
func expectStatusCodeXX(expected int) statusCodeValidatorFunc {
begining := int(math.Floor(float64(expected/100))) * 100
end := begining + 99
return func(statusCode int) bool {
return (statusCode >= begining) && (statusCode <= end)
}
}