fn: funcfile.Headers are now simple maps (#425)

Fixes #422
This commit is contained in:
C Cirello
2016-12-13 19:18:57 +01:00
committed by GitHub
parent 446e2b19e6
commit d2a81b57fb
2 changed files with 19 additions and 15 deletions

View File

@@ -160,6 +160,10 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
ff.Timeout = &dur
}
headers := make(map[string][]string)
for k, v := range ff.Headers {
headers[k] = []string{v}
}
body := functions.RouteWrapper{
Route: functions.Route{
Path: *ff.Path,
@@ -167,7 +171,7 @@ func (p *deploycmd) route(path string, ff *funcfile) error {
Memory: *ff.Memory,
Type_: *ff.Type,
Config: expandEnvConfig(ff.Config),
Headers: ff.Headers,
Headers: headers,
Format: *ff.Format,
MaxConcurrency: int32(*ff.MaxConcurrency),
Timeout: int32(ff.Timeout.Seconds()),

View File

@@ -32,20 +32,20 @@ type fftest struct {
}
type funcfile struct {
Name string `yaml:"name,omitempty",json:"name,omitempty"`
Version string `yaml:"version,omitempty",json:"version,omitempty"`
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
Entrypoint *string `yaml:"entrypoint,omitempty",json:"entrypoint,omitempty"`
Path *string `yaml:"path,omitempty",json:"path,omitempty"`
Type *string `yaml:"type,omitempty",json:"type,omitempty"`
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
Timeout *time.Duration `yaml:"timeout,omitempty",json:"timeout,omitempty"`
MaxConcurrency *int `yaml:"max_concurrency,omitempty",json:"max_concurrency,omitempty"`
Headers map[string][]string `yaml:"headers,omitempty",json:"headers,omitempty"`
Config map[string]string `yaml:"config,omitempty",json:"config,omitempty"`
Build []string `yaml:"build,omitempty",json:"build,omitempty"`
Tests []fftest `yaml:"tests,omitempty",json:"tests,omitempty"`
Name string `yaml:"name,omitempty",json:"name,omitempty"`
Version string `yaml:"version,omitempty",json:"version,omitempty"`
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
Entrypoint *string `yaml:"entrypoint,omitempty",json:"entrypoint,omitempty"`
Path *string `yaml:"path,omitempty",json:"path,omitempty"`
Type *string `yaml:"type,omitempty",json:"type,omitempty"`
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
Timeout *time.Duration `yaml:"timeout,omitempty",json:"timeout,omitempty"`
MaxConcurrency *int `yaml:"max_concurrency,omitempty",json:"max_concurrency,omitempty"`
Headers map[string]string `yaml:"headers,omitempty",json:"headers,omitempty"`
Config map[string]string `yaml:"config,omitempty",json:"config,omitempty"`
Build []string `yaml:"build,omitempty",json:"build,omitempty"`
Tests []fftest `yaml:"tests,omitempty",json:"tests,omitempty"`
}
func (ff *funcfile) FullName() string {