mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
change update from PUT method to PATCH (#440)
This commit is contained in:
@@ -232,7 +232,7 @@ func TestAppUpdate(t *testing.T) {
|
|||||||
router := testRouter(test.mock, &mqs.Mock{}, rnr, tasks)
|
router := testRouter(test.mock, &mqs.Mock{}, rnr, tasks)
|
||||||
|
|
||||||
body := bytes.NewBuffer([]byte(test.body))
|
body := bytes.NewBuffer([]byte(test.body))
|
||||||
_, rec := routerRequest(t, router, "PUT", test.path, body)
|
_, rec := routerRequest(t, router, "PATCH", test.path, body)
|
||||||
|
|
||||||
if rec.Code != test.expectedCode {
|
if rec.Code != test.expectedCode {
|
||||||
t.Log(buf.String())
|
t.Log(buf.String())
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ func TestRouteUpdate(t *testing.T) {
|
|||||||
|
|
||||||
body := bytes.NewBuffer([]byte(test.body))
|
body := bytes.NewBuffer([]byte(test.body))
|
||||||
|
|
||||||
_, rec := routerRequest(t, router, "PUT", test.path, body)
|
_, rec := routerRequest(t, router, "PATCH", test.path, body)
|
||||||
|
|
||||||
if rec.Code != test.expectedCode {
|
if rec.Code != test.expectedCode {
|
||||||
t.Log(buf.String())
|
t.Log(buf.String())
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
|
|||||||
var err error
|
var err error
|
||||||
var payload io.Reader
|
var payload io.Reader
|
||||||
|
|
||||||
if c.Request.Method == "POST" || c.Request.Method == "PUT" {
|
if c.Request.Method == "POST" {
|
||||||
payload = c.Request.Body
|
payload = c.Request.Body
|
||||||
// Load complete body and close
|
// Load complete body and close
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ func (s *Server) bindHandlers() {
|
|||||||
v1.POST("/apps", s.handleAppCreate)
|
v1.POST("/apps", s.handleAppCreate)
|
||||||
|
|
||||||
v1.GET("/apps/:app", s.handleAppGet)
|
v1.GET("/apps/:app", s.handleAppGet)
|
||||||
v1.PUT("/apps/:app", s.handleAppUpdate)
|
v1.PATCH("/apps/:app", s.handleAppUpdate)
|
||||||
v1.DELETE("/apps/:app", s.handleAppDelete)
|
v1.DELETE("/apps/:app", s.handleAppDelete)
|
||||||
|
|
||||||
v1.GET("/routes", s.handleRouteList)
|
v1.GET("/routes", s.handleRouteList)
|
||||||
@@ -146,7 +146,7 @@ func (s *Server) bindHandlers() {
|
|||||||
apps.GET("/routes", s.handleRouteList)
|
apps.GET("/routes", s.handleRouteList)
|
||||||
apps.POST("/routes", s.handleRouteCreate)
|
apps.POST("/routes", s.handleRouteCreate)
|
||||||
apps.GET("/routes/*route", s.handleRouteGet)
|
apps.GET("/routes/*route", s.handleRouteGet)
|
||||||
apps.PUT("/routes/*route", s.handleRouteUpdate)
|
apps.PATCH("/routes/*route", s.handleRouteUpdate)
|
||||||
apps.DELETE("/routes/*route", s.handleRouteDelete)
|
apps.DELETE("/routes/*route", s.handleRouteDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ swagger: '2.0'
|
|||||||
info:
|
info:
|
||||||
title: IronFunctions
|
title: IronFunctions
|
||||||
description: The open source serverless platform.
|
description: The open source serverless platform.
|
||||||
version: "0.1.26"
|
version: "0.1.27"
|
||||||
# the domain of the service
|
# the domain of the service
|
||||||
host: "127.0.0.1:8080"
|
host: "127.0.0.1:8080"
|
||||||
# array of all schemes that your API supports
|
# array of all schemes that your API supports
|
||||||
@@ -123,7 +123,7 @@ paths:
|
|||||||
description: Unexpected error
|
description: Unexpected error
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/Error'
|
$ref: '#/definitions/Error'
|
||||||
put:
|
patch:
|
||||||
summary: "Updates an app."
|
summary: "Updates an app."
|
||||||
description: "You can set app level settings here. "
|
description: "You can set app level settings here. "
|
||||||
tags:
|
tags:
|
||||||
@@ -220,7 +220,7 @@ paths:
|
|||||||
$ref: '#/definitions/Error'
|
$ref: '#/definitions/Error'
|
||||||
|
|
||||||
/apps/{app}/routes/{route}:
|
/apps/{app}/routes/{route}:
|
||||||
put:
|
patch:
|
||||||
summary: Update a Route
|
summary: Update a Route
|
||||||
description: Update a route
|
description: Update a route
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
Reference in New Issue
Block a user