MCPcopy Create free account
hub / github.com/crewjam/saml / ServeLink

Function ServeLink

example/service.go:121–130  ·  view source on GitHub ↗

ServeLink handles requests to redirect to a link

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

119
120// ServeLink handles requests to redirect to a link
121func ServeLink(w http.ResponseWriter, r *http.Request) {
122 links.mu.Lock()
123 l, ok := links.links[r.PathValue("link")]
124 links.mu.Unlock()
125 if !ok {
126 http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
127 return
128 }
129 http.Redirect(w, r, l.Target, http.StatusFound)
130}
131
132// ListLinks returns a list of the current user's links
133func ListLinks(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.45
RedirectMethod · 0.45

Tested by

no test coverage detected