File tree 1 file changed +44
-1
lines changed
1 file changed +44
-1
lines changed Original file line number Diff line number Diff line change 1
- # msgstore
1
+ # msgstore
2
+
3
+ Dependencies: Gorilla Mux
4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
5
+ go get github.com/gorilla/mux
6
+
7
+ Note:
8
+ 1. The max allowed length for message is 4096. Added this constraint for disallowing too big strings
9
+
10
+ Test
11
+ ----
12
+
13
+ curl http://localhost:8080/messages -d "Life is beautiful"
14
+
15
+ {"id":1}
16
+
17
+ curl http://localhost:8080/messages/1
18
+
19
+ Life is beautiful
20
+
21
+
22
+ go test results
23
+ --------------
24
+ C:\go-projects\digitalanimal>go test github.com/pikeview/msgstore
25
+ ok github.com/pikeview/msgstore 0.264s
26
+
27
+ C:\go-projects\digitalanimal>go test github.com/pikeview/msgstore -v
28
+ === RUN TestStoreMsg
29
+ 2016/06/09 19:42:15 Received message 1 => Hello World
30
+ --- PASS: TestStoreMsg (0.00s)
31
+ === RUN TestStoreTooLongMsg
32
+ error occured%!(EXTRA string=internal error>> PostMsgHandler:[Max content length 4096] err[http: request body too large])--- PASS: TestStoreTooLongMsg (0.02s)
33
+ === RUN TestGetMsgHandler
34
+ 2016/06/09 19:42:15 key 1
35
+ 2016/06/09 19:42:15 Key found [1]=>[Hello World]
36
+ --- PASS: TestGetMsgHandler (0.00s)
37
+ === RUN TestGetNonExistentMsgHandler
38
+ 2016/06/09 19:42:15 key 31
39
+ 2016/06/09 19:42:15 Key Not found 31
40
+ --- PASS: TestGetNonExistentMsgHandler (0.00s)
41
+ PASS
42
+ ok github.com/pikeview/msgstore 0.387s
43
+
44
+ C:\go-projects\digitalanimal>
You can’t perform that action at this time.
0 commit comments