func TestCanvasURL(t *testing.T) { t.Parallel() expected := "http://apps.facebook.com/fbrelll/" context := fromValues(t, url.Values{}) if context.CanvasURL("/") != expected { t.Fatalf("Did not find expected URL %s instead found %s", expected, context.CanvasURL("/")) } }
func TestCanvasURLBeta(t *testing.T) { t.Parallel() expected := "http://apps.beta.facebook.com/fbrelll/?server=beta" values := url.Values{} values.Add("server", "beta") context := fromValues(t, values) if context.CanvasURL("/") != expected { t.Fatalf("Did not find expected URL %s instead found %s", expected, context.CanvasURL("/")) } }
// Handler for /info/ to see a JSON view of some server context. func Info(w http.ResponseWriter, r *http.Request) { context, err := context.FromRequest(r) if err != nil { view.Error(w, r, err) return } info := map[string]interface{}{ "request": map[string]interface{}{ "method": r.Method, "form": r.Form, "url": map[string]interface{}{ "path": r.URL.Path, "query": r.URL.RawQuery, }, "headers": headerMap(r.Header), }, "context": context, "pageTabURL": context.PageTabURL("/"), "canvasURL": context.CanvasURL("/"), "sdkURL": context.SdkURL(), } if version != "" { info["version"] = version } humanJSON(info, w, r) }