當前位置: 首頁>>代碼示例>>Golang>>正文


Golang httper.HttpConnection函數代碼示例

本文整理匯總了Golang中github.com/ScruffyProdigy/TheRack/httper.HttpConnection函數的典型用法代碼示例。如果您正苦於以下問題:Golang HttpConnection函數的具體用法?Golang HttpConnection怎麽用?Golang HttpConnection使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了HttpConnection函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: init

func init() {
	rackup := rack.New()
	rackup.Add(Form)
	rackup.Add(HttpWare)

	conn := httper.HttpConnection(":4007")
	go conn.Go(rackup)
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:8,代碼來源:parser_test.go

示例2: init

func init() {
	rackup := rack.New()
	rackup.Add(parser.Form)
	rackup.Add(Override)
	rackup.Add(HttpWare)

	conn := httper.HttpConnection(":4005")
	go conn.Go(rackup)
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:9,代碼來源:methoder_test.go

示例3: Example_NoLogger

func Example_NoLogger() {
	rackup := rack.New()
	rackup.Add(HelloWorldWare)

	conn := httper.HttpConnection(":4004")
	go conn.Go(rackup)
	http.Get("http://localhost:4004")
	//output:
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:9,代碼來源:logger_test.go

示例4: Example_Basic

func Example_Basic() {
	rackup := rack.New()
	rackup.Add(New("/static/", "./test_files"))

	conn := httper.HttpConnection(":4013")
	go conn.Go(rackup)

	GetFrom("http://localhost:4013/static/test.txt")
	//output: Hello World!
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:10,代碼來源:staticer_test.go

示例5: Example_Skipped

func Example_Skipped() {
	rackup := rack.New()
	rackup.Add(HttpWare)

	conn := httper.HttpConnection(":3001")
	go conn.Go(rackup)

	PostTo("http://localhost:3001", url.Values{"Name": {"Jim"}})
	//output: Welcome, Jim
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:10,代碼來源:parser_test.go

示例6: Example_Basic

func Example_Basic() {
	rackup := rack.New()
	rackup.Add(New(os.Stdout, "Log Test - ", 0))
	rackup.Add(HelloWorldWare)

	conn := httper.HttpConnection(":4003")
	go conn.Go(rackup)
	http.Get("http://localhost:4003")
	//output: Log Test - Hello World!
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:10,代碼來源:logger_test.go

示例7: Example_Basic

func Example_Basic() {
	rackup := rack.New()
	rackup.Add(logger.New(os.Stdout, "", 0))
	rackup.Add(Logger)

	conn := httper.HttpConnection(":4009")
	go conn.Go(rackup)
	http.Get("http://localhost:4009/location")
	//output: GET /location
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:10,代碼來源:requestlogger_test.go

示例8: init

func init() {
	cept := New()
	cept.Intercept("/helloworld", HelloWorldWare)

	rackup := rack.New()
	rackup.Add(cept)
	rackup.Add(RootWare)

	conn := httper.HttpConnection(":4002")
	go conn.Go(rackup)
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:11,代碼來源:interceptor_test.go

示例9: Example_Multipart

func Example_Multipart() {
	rackup := rack.New()
	rackup.Add(Multipart{256})
	rackup.Add(FileWare)

	conn := httper.HttpConnection(":3002")
	go conn.Go(rackup)

	SendFileTo("http://localhost:3002", "./test_files/helloworld.txt")
	//output: Hello World
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:11,代碼來源:parser_test.go

示例10: Example_NoError

func Example_NoError() {
	rackup := rack.New()
	rackup.Add(ErrorHandler)
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		httper.V(vars).SetMessageString("Just Fine!")
	}))

	conn := httper.HttpConnection(":3002")
	go conn.Go(rackup)

	GetFrom("http://localhost:3002/")
	//output: Just Fine!
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:13,代碼來源:errorhandler_test.go

示例11: Example_Specific

func Example_Specific() {
	rackup := rack.New()
	rackup.Add(templater.GetTemplates("test_templates"))
	rackup.Add(encapsulator.AddLayout)
	rackup.Add(SetErrorLayout)

	conn := httper.HttpConnection(":3001")
	go conn.Go(rackup)

	GetFrom("http://localhost:3001/")

	//output: Not Found
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:13,代碼來源:statuser_test.go

示例12: init

func init() {
	//set up oauth host

	hoster := &FakeProvider{
		YourURL:     "http://localhost:4006",
		YourLanding: "/callback",
		MyURL:       "http://localhost:3001",
	}

	hostconn := httper.HttpConnection(":3001")
	go hostconn.Go(hoster.Middleware())

	//set up our site
	cept := New(hoster, TokenHandlerFunc)

	rackup := rack.New()
	rackup.Add(sessioner.Middleware)
	rackup.Add(cept)

	conn := httper.HttpConnection(":4006")
	go conn.Go(rackup)
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:22,代碼來源:oauther_test.go

示例13: Example_SpecificOverride

func Example_SpecificOverride() {
	rackup := rack.New()
	rackup.Add(templater.GetTemplates("test_templates"))
	rackup.Add(encapsulator.AddLayout)
	rackup.Add(SetErrorLayout)
	rackup.Add(ErrorWare2)

	conn := httper.HttpConnection(":3002")
	go conn.Go(rackup)

	GetFrom("http://localhost:3002/")

	//output: Not Implemented!
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:14,代碼來源:statuser_test.go

示例14: Example_General

func Example_General() {
	rackup := rack.New()
	rackup.Add(templater.GetTemplates("test_templates"))
	rackup.Add(encapsulator.AddLayout)
	rackup.Add(SetErrorLayout)
	rackup.Add(ErrorWare)

	conn := httper.HttpConnection(":4014")
	go conn.Go(rackup)

	GetFrom("http://localhost:4014/")

	//output: Error - 500
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:14,代碼來源:statuser_test.go

示例15: Example_Basic

func Example_Basic() {
	rackup := rack.New()
	rackup.Add(V{"world": "World!"})
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		world := vars["world"].(string)
		(httper.V)(vars).SetMessageString("Hello " + world)
	}))

	conn := httper.HttpConnection(":4015")
	go conn.Go(rackup)

	GetFrom("http://localhost:4015/")
	//output: Hello World!
}
開發者ID:ScruffyProdigy,項目名稱:Middleware,代碼行數:14,代碼來源:varser_test.go


注:本文中的github.com/ScruffyProdigy/TheRack/httper.HttpConnection函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。