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


Golang utils.NewHTTPRequestFactory函數代碼示例

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


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

示例1: HTTPRequestFactory

func (srv *Server) HTTPRequestFactory() *utils.HTTPRequestFactory {
	if srv.reqFactory == nil {
		ud := utils.NewHTTPUserAgentDecorator(srv.versionInfos()...)
		factory := utils.NewHTTPRequestFactory(ud)
		srv.reqFactory = factory
	}
	return srv.reqFactory
}
開發者ID:ksyz,項目名稱:docker,代碼行數:8,代碼來源:server.go

示例2: spawnTestRegistry

func spawnTestRegistry(t *testing.T) *Registry {
	authConfig := &auth.AuthConfig{}
	r, err := NewRegistry(authConfig, utils.NewHTTPRequestFactory(), makeURL("/v1/"))
	if err != nil {
		t.Fatal(err)
	}
	return r
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:8,代碼來源:registry_test.go

示例3: HTTPRequestFactory

func (srv *Server) HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory {
	if srv.reqFactory == nil {
		ud := utils.NewHTTPUserAgentDecorator(srv.versionInfos()...)
		md := &utils.HTTPMetaHeadersDecorator{
			Headers: metaHeaders,
		}
		factory := utils.NewHTTPRequestFactory(ud, md)
		srv.reqFactory = factory
	}
	return srv.reqFactory
}
開發者ID:silpion,項目名稱:docker,代碼行數:11,代碼來源:server.go

示例4: HTTPRequestFactory

func HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory {
	// FIXME: this replicates the 'info' job.
	httpVersion := make([]utils.VersionInfo, 0, 4)
	httpVersion = append(httpVersion, &simpleVersionInfo{"docker", dockerversion.VERSION})
	httpVersion = append(httpVersion, &simpleVersionInfo{"go", runtime.Version()})
	httpVersion = append(httpVersion, &simpleVersionInfo{"git-commit", dockerversion.GITCOMMIT})
	if kernelVersion, err := utils.GetKernelVersion(); err == nil {
		httpVersion = append(httpVersion, &simpleVersionInfo{"kernel", kernelVersion.String()})
	}
	httpVersion = append(httpVersion, &simpleVersionInfo{"os", runtime.GOOS})
	httpVersion = append(httpVersion, &simpleVersionInfo{"arch", runtime.GOARCH})
	ud := utils.NewHTTPUserAgentDecorator(httpVersion...)
	md := &utils.HTTPMetaHeadersDecorator{
		Headers: metaHeaders,
	}
	factory := utils.NewHTTPRequestFactory(ud, md)
	return factory
}
開發者ID:Emsu,項目名稱:docker,代碼行數:18,代碼來源:registry.go


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