You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"cache","path":"cache","contentType":"directory"},{"name":"conf","path":"conf","contentType":"directory"},{"name":"harness","path":"harness","contentType":"directory"},{"name":"mail","path":"mail","contentType":"directory"},{"name":"modules","path":"modules","contentType":"directory"},{"name":"revel","path":"revel","contentType":"directory"},{"name":"samples","path":"samples","contentType":"directory"},{"name":"skeleton","path":"skeleton","contentType":"directory"},{"name":"templates","path":"templates","contentType":"directory"},{"name":"testdata","path":"testdata","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"binder.go","path":"binder.go","contentType":"file"},{"name":"binder_test.go","path":"binder_test.go","contentType":"file"},{"name":"compress.go","path":"compress.go","contentType":"file"},{"name":"compress_test.go","path":"compress_test.go","contentType":"file"},{"name":"config.go","path":"config.go","contentType":"file"},{"name":"controller.go","path":"controller.go","contentType":"file"},{"name":"errors.go","path":"errors.go","contentType":"file"},{"name":"fakeapp_test.go","path":"fakeapp_test.go","contentType":"file"},{"name":"field.go","path":"field.go","contentType":"file"},{"name":"filter.go","path":"filter.go","contentType":"file"},{"name":"filterconfig.go","path":"filterconfig.go","contentType":"file"},{"name":"filterconfig_test.go","path":"filterconfig_test.go","contentType":"file"},{"name":"flash.go","path":"flash.go","contentType":"file"},{"name":"http.go","path":"http.go","contentType":"file"},{"name":"i18n.go","path":"i18n.go","contentType":"file"},{"name":"i18n_test.go","path":"i18n_test.go","contentType":"file"},{"name":"intercept.go","path":"intercept.go","contentType":"file"},{"name":"intercept_test.go","path":"intercept_test.go","contentType":"file"},{"name":"invoker.go","path":"invoker.go","contentType":"file"},{"name":"invoker_test.go","path":"invoker_test.go","contentType":"file"},{"name":"libs.go","path":"libs.go","contentType":"file"},{"name":"panic.go","path":"panic.go","contentType":"file"},{"name":"params.go","path":"params.go","contentType":"file"},{"name":"params_test.go","path":"params_test.go","contentType":"file"},{"name":"results.go","path":"results.go","contentType":"file"},{"name":"results_test.go","path":"results_test.go","contentType":"file"},{"name":"revel.go","path":"revel.go","contentType":"file"},{"name":"router.go","path":"router.go","contentType":"file"},{"name":"router_test.go","path":"router_test.go","contentType":"file"},{"name":"server.go","path":"server.go","contentType":"file"},{"name":"server_test.go","path":"server_test.go","contentType":"file"},{"name":"session.go","path":"session.go","contentType":"file"},{"name":"template.go","path":"template.go","contentType":"file"},{"name":"tests.go","path":"tests.go","contentType":"file"},{"name":"util.go","path":"util.go","contentType":"file"},{"name":"util_test.go","path":"util_test.go","contentType":"file"},{"name":"validation.go","path":"validation.go","contentType":"file"},{"name":"validation_test.go","path":"validation_test.go","contentType":"file"},{"name":"validators.go","path":"validators.go","contentType":"file"},{"name":"watcher.go","path":"watcher.go","contentType":"file"}],"totalCount":56}},"fileTreeProcessingTime":11.296458000000001,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":27759824,"defaultBranch":"master","name":"revel","ownerLogin":"seanluo","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2014-12-09T09:46:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1085798?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"v0.8","listCacheKey":"v0:1614122898.937881","canEdit":false,"refType":"tag","currentOid":"00060899f7cee4fb9e54356b04d2f2a12707a35d"},"path":"server_test.go","currentUser":null,"blob":{"rawLines":["package revel","","import (","\t\"net/http\"","\t\"net/http/httptest\"","\t\"os\"","\t\"path\"","\t\"strings\"","\t\"testing\"",")","","// This tries to benchmark the usual request-serving pipeline to get an overall","// performance metric.","//","// Each iteration runs one mock request to display a hotel's detail page by id.","//","// Contributing parts:","// - Routing","// - Controller lookup / invocation","// - Parameter binding","// - Session, flash, i18n cookies","// - Render() call magic","// - Template rendering","func BenchmarkServeAction(b *testing.B) {","\tbenchmarkRequest(b, showRequest)","}","","func BenchmarkServeJson(b *testing.B) {","\tbenchmarkRequest(b, jsonRequest)","}","","func BenchmarkServePlaintext(b *testing.B) {","\tbenchmarkRequest(b, plaintextRequest)","}","","// This tries to benchmark the static serving overhead when serving an \"average","// size\" 7k file.","func BenchmarkServeStatic(b *testing.B) {","\tbenchmarkRequest(b, staticRequest)","}","","func benchmarkRequest(b *testing.B, req *http.Request) {","\tstartFakeBookingApp()","\tb.ResetTimer()","\tresp := httptest.NewRecorder()","\tfor i := 0; i \u003c b.N; i++ {","\t\thandle(resp, req)","\t}","}","","// Test that the booking app can be successfully run for a test.","func TestFakeServer(t *testing.T) {","\tstartFakeBookingApp()","","\tresp := httptest.NewRecorder()","","\t// First, test that the expected responses are actually generated","\thandle(resp, showRequest)","\tif !strings.Contains(resp.Body.String(), \"300 Main St.\") {","\t\tt.Errorf(\"Failed to find hotel address in action response:\\n%s\", resp.Body)","\t\tt.FailNow()","\t}","\tresp.Body.Reset()","","\thandle(resp, staticRequest)","\tsessvarsSize := getFileSize(t, path.Join(BasePath, \"public\", \"js\", \"sessvars.js\"))","\tif int64(resp.Body.Len()) != sessvarsSize {","\t\tt.Errorf(\"Expected sessvars.js to have %d bytes, got %d:\\n%s\", sessvarsSize, resp.Body.Len(), resp.Body)","\t\tt.FailNow()","\t}","\tresp.Body.Reset()","","\thandle(resp, jsonRequest)","\tif !strings.Contains(resp.Body.String(), `\"Address\":\"300 Main St.\"`) {","\t\tt.Errorf(\"Failed to find hotel address in JSON response:\\n%s\", resp.Body)","\t\tt.FailNow()","\t}","\tresp.Body.Reset()","","\thandle(resp, plaintextRequest)","\tif resp.Body.String() != \"Hello, World!\" {","\t\tt.Errorf(\"Failed to find greeting in plaintext response:\\n%s\", resp.Body)","\t\tt.FailNow()","\t}","","\tresp.Body = nil","}","","func getFileSize(t *testing.T, name string) int64 {","\tfi, err := os.Stat(name)","\tif err != nil {","\t\tt.Errorf(\"Unable to stat file:\\n%s\", name)","\t\tt.FailNow()","\t}","\treturn fi.Size()","}","","var (","\tshowRequest, _ = http.NewRequest(\"GET\", \"/hotels/3\", nil)","\tstaticRequest, _ = http.NewRequest(\"GET\", \"/public/js/sessvars.js\", nil)","\tjsonRequest, _ = http.NewRequest(\"GET\", \"/hotels/3/booking\", nil)","\tplaintextRequest, _ = http.NewRequest(\"GET\", \"/hotels\", nil)",")"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/seanluo/revel/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"server_test.go","displayUrl":"https://github.com/seanluo/revel/blob/v0.8/server_test.go?raw=true","headerInfo":{"blobSize":"2.6 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":null,"isGitLfs":false,"onBranch":false,"shortPath":"8c3cf04","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fseanluo%2Frevel%2Fblob%2Fv0.8%2Fserver_test.go","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"103","truncatedSloc":"88"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Go","languageID":132,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/seanluo/revel/blob/v0.8/server_test.go","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/seanluo/revel/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/seanluo/revel/raw/refs/tags/v0.8/server_test.go","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"BenchmarkServeAction","kind":"function","ident_start":468,"ident_end":488,"extent_start":463,"extent_end":540,"fully_qualified_name":"BenchmarkServeAction","ident_utf16":{"start":{"line_number":23,"utf16_col":5},"end":{"line_number":23,"utf16_col":25}},"extent_utf16":{"start":{"line_number":23,"utf16_col":0},"end":{"line_number":25,"utf16_col":1}}},{"name":"BenchmarkServeJson","kind":"function","ident_start":547,"ident_end":565,"extent_start":542,"extent_end":617,"fully_qualified_name":"BenchmarkServeJson","ident_utf16":{"start":{"line_number":27,"utf16_col":5},"end":{"line_number":27,"utf16_col":23}},"extent_utf16":{"start":{"line_number":27,"utf16_col":0},"end":{"line_number":29,"utf16_col":1}}},{"name":"BenchmarkServePlaintext","kind":"function","ident_start":624,"ident_end":647,"extent_start":619,"extent_end":704,"fully_qualified_name":"BenchmarkServePlaintext","ident_utf16":{"start":{"line_number":31,"utf16_col":5},"end":{"line_number":31,"utf16_col":28}},"extent_utf16":{"start":{"line_number":31,"utf16_col":0},"end":{"line_number":33,"utf16_col":1}}},{"name":"BenchmarkServeStatic","kind":"function","ident_start":809,"ident_end":829,"extent_start":804,"extent_end":883,"fully_qualified_name":"BenchmarkServeStatic","ident_utf16":{"start":{"line_number":37,"utf16_col":5},"end":{"line_number":37,"utf16_col":25}},"extent_utf16":{"start":{"line_number":37,"utf16_col":0},"end":{"line_number":39,"utf16_col":1}}},{"name":"benchmarkRequest","kind":"function","ident_start":890,"ident_end":906,"extent_start":885,"extent_end":1065,"fully_qualified_name":"benchmarkRequest","ident_utf16":{"start":{"line_number":41,"utf16_col":5},"end":{"line_number":41,"utf16_col":21}},"extent_utf16":{"start":{"line_number":41,"utf16_col":0},"end":{"line_number":48,"utf16_col":1}}},{"name":"TestFakeServer","kind":"function","ident_start":1137,"ident_end":1151,"extent_start":1132,"extent_end":2196,"fully_qualified_name":"TestFakeServer","ident_utf16":{"start":{"line_number":51,"utf16_col":5},"end":{"line_number":51,"utf16_col":19}},"extent_utf16":{"start":{"line_number":51,"utf16_col":0},"end":{"line_number":86,"utf16_col":1}}},{"name":"getFileSize","kind":"function","ident_start":2203,"ident_end":2214,"extent_start":2198,"extent_end":2374,"fully_qualified_name":"getFileSize","ident_utf16":{"start":{"line_number":88,"utf16_col":5},"end":{"line_number":88,"utf16_col":16}},"extent_utf16":{"start":{"line_number":88,"utf16_col":0},"end":{"line_number":95,"utf16_col":1}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/seanluo/revel/branches":{"post":"WatbjzeyCVQUoBjXFJHKtG8TLuVGTPBOqQOkDtoIV-eT46iEWdn4zYjdC8JewNY6U7B8WMyTxUIq4IywwrQbSw"},"/repos/preferences":{"post":"v4qTC-yKsX6jmNVUKUTJTr0g7qS-ZsaB1ERZhpayEhcPuherG_bAL0ssw_VxGFELJ-eLoX_-aOCcBZGw_TElhQ"}}},"title":"revel/server_test.go at v0.8 · seanluo/revel","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}