• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang httper.HttpConnection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ScruffyProdigy/TheRack/httper.HttpConnection函数的典型用法代码示例。如果您正苦于以下问题:Golang HttpConnection函数的具体用法?Golang HttpConnection怎么用?Golang HttpConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HttpConnection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Example_Session

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

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

	var cookies []*http.Cookie
	for i := 0; i < 4; i++ {
		cookies = GetWithCookies("http://localhost:4012", cookies)
	}
	//output: 1234
}
开发者ID:ScruffyProdigy,项目名称:Middleware,代码行数:14,代码来源:sessioner_test.go


示例17: Example_BasicError

func Example_BasicError() {
	rackup := rack.New()
	rackup.Add(ErrorHandler)
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		httper.V(vars).SetMessageString("Just Fine!")
		array := make([]byte, 0)
		array[1] = 0 //this action results in a runtime error; we are indexing past the range of the slice
	}))

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

	GetFrom("http://localhost:4001/")
	//output: runtime error: index out of range
}
开发者ID:ScruffyProdigy,项目名称:Middleware,代码行数:15,代码来源:errorhandler_test.go


示例18: Example_NoLayout

func Example_NoLayout() {
	rackup := rack.New()
	rackup.Add(templater.GetTemplates("./test_templates"))
	rackup.Add(AddLayout)
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		vars["Title"] = "Hello World"
		(httper.V)(vars).AppendMessageString("Hello World!")
	}))

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

	GetFrom("http://localhost:3001/")
	//output: Hello World!
}
开发者ID:ScruffyProdigy,项目名称:Middleware,代码行数:15,代码来源:encapsulator_test.go


示例19: Example_Basic

func Example_Basic() {
	rackup := rack.New()
	rackup.Add(templater.GetTemplates("./test_templates"))
	rackup.Add(AddLayout)
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		vars["Layout"] = "test"
		vars["Title"] = "Hello World"
		(httper.V)(vars).AppendMessageString("Hello World!")
	}))

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

	GetFrom("http://localhost:4000/")
	//output: <html><head><title>Hello World</title></head><body>Hello World!</body></html>
}
开发者ID:ScruffyProdigy,项目名称:Middleware,代码行数:16,代码来源:encapsulator_test.go


示例20: Example_Render

func Example_Render() {
	rackup := rack.New()
	rackup.Add(logger.New(os.Stdout, "", 0))
	rackup.Add(templater.GetTemplates("./test_templates"))
	rackup.Add(rack.Func(func(vars map[string]interface{}, next func()) {
		vars["Object"] = "World"
		next()
	}))
	rackup.Add(Renderer{"test"})

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

	GetFrom("http://localhost:4010/")
	//output: Hello World
}
开发者ID:ScruffyProdigy,项目名称:Middleware,代码行数:16,代码来源:renderer_test.go



注:本文中的github.com/ScruffyProdigy/TheRack/httper.HttpConnection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang rack.New函数代码示例发布时间:2022-05-28
下一篇:
Golang scrapinghub.Jobs类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap