mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fix API inconsistencies (#404)
* fix api inconsistencies * handling empty format cases * code style
This commit is contained in:
@@ -345,8 +345,12 @@ func (ds *BoltDatastore) UpdateRoute(ctx context.Context, newroute *models.Route
|
||||
if newroute.Timeout != 0 {
|
||||
route.Timeout = newroute.Timeout
|
||||
}
|
||||
route.Format = newroute.Format
|
||||
route.MaxConcurrency = newroute.MaxConcurrency
|
||||
if newroute.Format != "" {
|
||||
route.Format = newroute.Format
|
||||
}
|
||||
if newroute.MaxConcurrency != 0 {
|
||||
route.MaxConcurrency = newroute.MaxConcurrency
|
||||
}
|
||||
if newroute.Headers != nil {
|
||||
if route.Headers == nil {
|
||||
route.Headers = map[string][]string{}
|
||||
@@ -364,6 +368,10 @@ func (ds *BoltDatastore) UpdateRoute(ctx context.Context, newroute *models.Route
|
||||
}
|
||||
}
|
||||
|
||||
if err := route.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := json.Marshal(route)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user