-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entities.go
59 lines (52 loc) · 1.26 KB
/
Entities.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
package goose
import "net/http"
type GooseMiddleware func(*http.Request, *GooseMessage) (bool, *GooseResponse)
type GooseEndpoint func(*http.Request, *GooseMessage) interface{}
type GooseResponse struct {
StatusCode int
Response interface{}
Headers map[string]string
}
/**
* Goose route will hold all route related details. Like method, Url, Middlewares and Endpoint
*/
type GooseRoute struct {
methods []string
uRL string
uRLRegex string
contentType string
cors map[string]string
hasCors bool
middlewares []GooseMiddleware
endpoint GooseEndpoint
hasDynamics bool
dynamics []string
}
type GooseMessage struct {
RequestId int64
RequestTime int64
PostBody string
Holder interface{}
RequestHeaders map[string]string
GetParams map[string]string
UrlParams map[string]string
}
const (
GET = "GET"
POST = "POST"
PATCH = "PATCH"
OPTIONS = "OPTIONS"
DELETE = "DELETE"
)
const (
CONTENT_TYPE = "Content-Type"
APPLICATION_XML = "application/xml"
APPLICATION_JSON = "application/json"
PLAIN_TEXT = "text/plain"
USER_AGENT = "User-Agent"
AGENT = "golang Goose1.1"
)
const (
METHOD_NOT_ALLOWED = "Method Not Allowed."
PAGE_NOT_FOUND = "Page not found."
)