Skip to content

Commit 884ec66

Browse files
committed
Actually add kitspace router
1 parent 18280de commit 884ec66

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

routers/kitspace.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package routers
2+
3+
import (
4+
"bytes"
5+
"code.gitea.io/gitea/modules/context"
6+
"io/ioutil"
7+
"net/http"
8+
)
9+
10+
func Kitspace(ctx *context.Context) []byte {
11+
url := "http://localhost:3001/"
12+
data := []byte(`{"hello": "world"}`)
13+
resp, err := http.Post(url, "application/json", bytes.NewBuffer(data))
14+
if err != nil {
15+
panic(err)
16+
}
17+
defer resp.Body.Close()
18+
body, err := ioutil.ReadAll(resp.Body)
19+
if err != nil {
20+
panic(err)
21+
}
22+
return body
23+
}

0 commit comments

Comments
 (0)