func TestPageTabURL(t *testing.T) { t.Parallel() expected := "http://www.facebook.com/pages/Rell-Page-for-Tabs" + "/141929622497380?sk=app_184484190795&app_data=Lw%3D%3D" context := fromValues(t, url.Values{}) if context.PageTabURL("/") != expected { t.Fatalf("Did not find expected URL %s instead found %s", expected, context.PageTabURL("/")) } }
// 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) }
func TestPageTabURLBeta(t *testing.T) { t.Parallel() expected := "http://www.beta.facebook.com/pages/" + "Rell-Page-for-Tabs/141929622497380?sk=app_184484190795" + "&app_data=Lz9zZXJ2ZXI9YmV0YQ%3D%3D" values := url.Values{} values.Add("server", "beta") context := fromValues(t, values) actual := context.PageTabURL("/") if actual != expected { t.Fatalf("Did not find expected URL %s instead found %s", expected, actual) } }