-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathproxy.go
82 lines (75 loc) · 2.77 KB
/
proxy.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
package arbor
import (
"net/http"
"github.com/arbor-dev/arbor/proxy"
)
// DELETE provides a proxy DELETE request allowing authorized clients to make DELETE requests of the microservices
//
// Pass the http Request from the client and the ResponseWriter it expects.
//
// Pass the target url of the backend service (not the url the client called).
//
// Pass the format of the service.
//
// Pass a authorization token (optional).
//
// Will call the service and return the result to the client.
func DELETE(w http.ResponseWriter, url string, format string, token string, r *http.Request) {
proxy.DELETE(w, r, url, format, token)
}
// GET provides a proxy GET request allowing authorized clients to make GET requests of the microservices
//
// Pass the http Request from the client and the ResponseWriter it expects.
//
// Pass the target url of the backend service (not the url the client called).
//
// Pass the format of the service.
//
// Pass a authorization token (optional).
//
// Will call the service and return the result to the client.
func GET(w http.ResponseWriter, url string, format string, token string, r *http.Request) {
proxy.GET(w, r, url, format, token)
}
// PATCH provides a proxy PATCH request allowing authorized clients to make PATCH requests of the microservices
//
// Pass the http Request from the client and the ResponseWriter it expects.
//
// Pass the target url of the backend service (not the url the client called).
//
// Pass the format of the service.
//
// Pass a authorization token (optional).
//
// Will call the service and return the result to the client.
func PATCH(w http.ResponseWriter, url string, format string, token string, r *http.Request) {
proxy.PATCH(w, r, url, format, token)
}
// POST provides a proxy POST request allowing authorized clients to make POST requests of the microservices
//
// Pass the http Request from the client and the ResponseWriter it expects.
//
// Pass the target url of the backend service (not the url the client called).
//
// Pass the format of the service.
//
// Pass a authorization token (optional).
//
// Will call the service and return the result to the client.
func POST(w http.ResponseWriter, url string, format string, token string, r *http.Request) {
proxy.POST(w, r, url, format, token)
}
// PUT provides a proxy PUT request allowing authorized clients to make PUT requests of the microservices
//
// Pass the http Request from the client and the ResponseWriter it expects.
//
// Pass the target url of the backend service (not the url the client called).
//
// Pass the format of the service.
//
// Pass a authorization token (optional).
//
// Will call the service and return the result to the client.
func PUT(w http.ResponseWriter, url string, format string, token string, r *http.Request) {
proxy.PUT(w, r, url, format, token)
}