Full url in response

This commit is contained in:
Ian Gulliver
2024-12-03 20:33:57 -08:00
parent 29c97c5c09
commit 72e2599b79
3 changed files with 12 additions and 80 deletions

View File

@@ -30,6 +30,7 @@ type ShortLinks struct {
type setResponse struct {
Short string `json:"short"`
Domain string `json:"domain"`
URL string `json:"url"`
}
type suggestResponse struct {
@@ -188,6 +189,7 @@ func (sl *ShortLinks) serveSet(w http.ResponseWriter, r *http.Request) {
sendJSON(w, setResponse{
Short: short,
Domain: sl.getDomain(r.Host),
URL: fmt.Sprintf("https://%s/%s", sl.getDomain(r.Host), short),
})
}