From 9d636cafabfc71dded161fa31feff179819968c3 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 11 Jul 2016 19:20:10 +0100 Subject: [PATCH] Rename response attributes --- web/handlers.go | 6 +++--- web/responses.go | 6 +++--- web/responses_easyjson.go | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/web/handlers.go b/web/handlers.go index 232ec08..761030b 100644 --- a/web/handlers.go +++ b/web/handlers.go @@ -71,9 +71,9 @@ func (h *Handlers) LookupAndRedirect(c *routing.Context) error { func (h *Handlers) respondWithShortened(c *routing.Context, uid []byte, url []byte) { c.SetStatusCode(fasthttp.StatusOK) response := ShortenedResponse{ - UID: string(uid), - ShortURL: h.makeShortURL(c, uid), - URL: string(url), + UID: string(uid), + URL: h.makeShortURL(c, uid), + Target: string(url), } respBytes, _ := json.Marshal(response) c.Write(respBytes) diff --git a/web/responses.go b/web/responses.go index f34bb34..676b205 100644 --- a/web/responses.go +++ b/web/responses.go @@ -4,9 +4,9 @@ package web // ShortenedResponse contains shortened URL info. type ShortenedResponse struct { - UID string `json:"uid"` - ShortURL string `json:"short_url"` - URL string `json:"url"` + UID string `json:"uid"` + URL string `json:"url"` + Target string `json:"target"` } // ErrorResponse contains error info. diff --git a/web/responses_easyjson.go b/web/responses_easyjson.go index fb8b8f1..c333843 100644 --- a/web/responses_easyjson.go +++ b/web/responses_easyjson.go @@ -79,10 +79,10 @@ func easyjson_559270ae_decode_github_com_jimeh_ozu_io_web_ShortenedResponse(in * switch key { case "uid": out.UID = string(in.String()) - case "short_url": - out.ShortURL = string(in.String()) case "url": out.URL = string(in.String()) + case "target": + out.Target = string(in.String()) default: in.SkipRecursive() } @@ -104,14 +104,14 @@ func easyjson_559270ae_encode_github_com_jimeh_ozu_io_web_ShortenedResponse(out out.RawByte(',') } first = false - out.RawString("\"short_url\":") - out.String(string(in.ShortURL)) + out.RawString("\"url\":") + out.String(string(in.URL)) if !first { out.RawByte(',') } first = false - out.RawString("\"url\":") - out.String(string(in.URL)) + out.RawString("\"target\":") + out.String(string(in.Target)) out.RawByte('}') } func (v ShortenedResponse) MarshalJSON() ([]byte, error) {