change update from PUT method to PATCH (#440)

This commit is contained in:
Pedro Nasser
2016-12-14 14:22:44 -02:00
committed by C Cirello
parent 3dc12d9f55
commit 4d7dde3486
5 changed files with 8 additions and 8 deletions

View File

@@ -232,7 +232,7 @@ func TestAppUpdate(t *testing.T) {
router := testRouter(test.mock, &mqs.Mock{}, rnr, tasks)
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 {
t.Log(buf.String())

View File

@@ -219,7 +219,7 @@ func TestRouteUpdate(t *testing.T) {
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 {
t.Log(buf.String())

View File

@@ -66,7 +66,7 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
var err error
var payload io.Reader
if c.Request.Method == "POST" || c.Request.Method == "PUT" {
if c.Request.Method == "POST" {
payload = c.Request.Body
// Load complete body and close
defer func() {

View File

@@ -136,7 +136,7 @@ func (s *Server) bindHandlers() {
v1.POST("/apps", s.handleAppCreate)
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.GET("/routes", s.handleRouteList)
@@ -146,7 +146,7 @@ func (s *Server) bindHandlers() {
apps.GET("/routes", s.handleRouteList)
apps.POST("/routes", s.handleRouteCreate)
apps.GET("/routes/*route", s.handleRouteGet)
apps.PUT("/routes/*route", s.handleRouteUpdate)
apps.PATCH("/routes/*route", s.handleRouteUpdate)
apps.DELETE("/routes/*route", s.handleRouteDelete)
}
}

View File

@@ -6,7 +6,7 @@ swagger: '2.0'
info:
title: IronFunctions
description: The open source serverless platform.
version: "0.1.26"
version: "0.1.27"
# the domain of the service
host: "127.0.0.1:8080"
# array of all schemes that your API supports
@@ -123,7 +123,7 @@ paths:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
put:
patch:
summary: "Updates an app."
description: "You can set app level settings here. "
tags:
@@ -220,7 +220,7 @@ paths:
$ref: '#/definitions/Error'
/apps/{app}/routes/{route}:
put:
patch:
summary: Update a Route
description: Update a route
tags: