mirror of
https://github.com/jimeh/ozu.io.git
synced 2026-02-19 08:06:39 +00:00
Make things pretty
This commit is contained in:
@@ -6,14 +6,18 @@ import (
|
||||
"github.com/qiangxue/fasthttp-routing"
|
||||
)
|
||||
|
||||
func makeURLResponse(c *routing.Context, uid []byte, url []byte) URLResponse {
|
||||
return URLResponse{
|
||||
func makeResponse(c *routing.Context, uid []byte, url []byte) Response {
|
||||
return Response{
|
||||
UID: string(uid),
|
||||
URL: makeShortURL(c, uid),
|
||||
Target: string(url),
|
||||
}
|
||||
}
|
||||
|
||||
func makeErrResponse(err error) Response {
|
||||
return Response{Error: err.Error()}
|
||||
}
|
||||
|
||||
func makeShortURL(c *routing.Context, uid []byte) string {
|
||||
shortURL := &url.URL{
|
||||
Scheme: "http",
|
||||
|
||||
Reference in New Issue
Block a user