diff --git a/common/version/version.go b/common/version/version.go index 07c258fbaaa71e176ed30705c1208b71d4dbd1eb..2803919b2687b074ade9aa3b25aaaf960ee4a600 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -1,4 +1,4 @@ package version //Version 版本号 -const Version = "3.1.1" +const Version = "3.1.4" diff --git a/go.mod b/go.mod index 2e4419413f0a4f8abeb61be170a908e9ae4f92b0..6c6d67ccb45ad196d611704d131180c9bc85bd79 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/eolinker/goku-api-gateway -go 1.12 +go 1.15 require ( github.com/cosiner/argv v0.0.1 // indirect diff --git a/node/gateway/application/backend/layer.go b/node/gateway/application/backend/layer.go index 3c5faeb9bc60d2cdb3a5dc9903fe7aa134a2c534..180e51376c45313df22baa63e12f040c55655b08 100644 --- a/node/gateway/application/backend/layer.go +++ b/node/gateway/application/backend/layer.go @@ -41,7 +41,9 @@ func (b *Layer) Send(deadline context.Context, ctx *common.Context, variables *i path := b.Path.Execution(variables) body := b.Body.Execution(variables) method := b.Method - + if method == "FOLLOW" { + method = ctx.ProxyRequest.Method + } r, finalTargetServer, retryTargetServers, err := b.Balance.Send(ctx, b.Protocol, method, path, ctx.ProxyRequest.Querys(), ctx.ProxyRequest.Headers(), []byte(body), b.TimeOut, b.Retry) if err != nil { diff --git a/server/dao/console-sqlite3/api.go b/server/dao/console-sqlite3/api.go index 4da2032fb42954d0105eac8496882eb152c1ae7c..55b45727cab6b6832facba7f10a57ba645f54b93 100644 --- a/server/dao/console-sqlite3/api.go +++ b/server/dao/console-sqlite3/api.go @@ -35,7 +35,7 @@ func (d *APIDao) AddAPI(apiName, alias, requestURL, targetURL, requestMethod, ta db := d.db now := time.Now().Format("2006-01-02 15:04:05") Tx, _ := db.Begin() - res, err := Tx.Exec("INSERT INTO goku_gateway_api (projectID,groupID,apiName,alias,requestURL,targetURL,requestMethod,targetMethod,protocol,linkAPIs,staticResponse,responseDataType,balanceName,isFollow,timeout,retryCount,alertValve,createTime,updateTime,managerID,lastUpdateUserID,createUserID,apiType) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", projectID, groupID, apiName, alias, requestURL, targetURL, requestMethod, targetMethod, protocol, linkAPIs, staticResponse, responseDataType, balanceName, isFollow, timeout, retryCount, alertValve, now, now, managerID, userID, userID, apiType) + res, err := Tx.Exec("INSERT INTO goku_gateway_api (projectID,groupID,apiName,requestURL,targetURL,requestMethod,targetMethod,protocol,linkAPIs,staticResponse,responseDataType,balanceName,isFollow,timeout,retryCount,alertValve,createTime,updateTime,managerID,lastUpdateUserID,createUserID,apiType) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", projectID, groupID, apiName, requestURL, targetURL, requestMethod, targetMethod, protocol, linkAPIs, staticResponse, responseDataType, balanceName, isFollow, timeout, retryCount, alertValve, now, now, managerID, userID, userID, apiType) if err != nil { Tx.Rollback() @@ -57,7 +57,7 @@ func (d *APIDao) EditAPI(apiName, alias, requestURL, targetURL, requestMethod, t db := d.db now := time.Now().Format("2006-01-02 15:04:05") Tx, _ := db.Begin() - _, err := Tx.Exec("UPDATE goku_gateway_api SET projectID = ?,groupID = ?,apiName = ?,alias = ?,requestURL = ?,targetURL = ?,requestMethod = ?,protocol = ?,balanceName = ?,targetMethod = ?,isFollow = ?,linkAPIs = ?,staticResponse = ?,responseDataType = ?,timeout = ?,retryCount = ?,alertValve = ?,updateTime = ?,managerID = ?,lastUpdateUserID = ? WHERE apiID = ?", projectID, groupID, apiName, alias, requestURL, targetURL, requestMethod, protocol, balanceName, targetMethod, isFollow, linkAPIs, staticResponse, responseDataType, timeout, retryCount, alertValve, now, managerID, userID, apiID) + _, err := Tx.Exec("UPDATE goku_gateway_api SET projectID = ?,groupID = ?,apiName = ?,requestURL = ?,targetURL = ?,requestMethod = ?,protocol = ?,balanceName = ?,targetMethod = ?,isFollow = ?,linkAPIs = ?,staticResponse = ?,responseDataType = ?,timeout = ?,retryCount = ?,alertValve = ?,updateTime = ?,managerID = ?,lastUpdateUserID = ? WHERE apiID = ?", projectID, groupID, apiName, requestURL, targetURL, requestMethod, protocol, balanceName, targetMethod, isFollow, linkAPIs, staticResponse, responseDataType, timeout, retryCount, alertValve, now, managerID, userID, apiID) if err != nil { Tx.Rollback() @@ -428,7 +428,7 @@ func (d *APIDao) BatchDeleteAPI(apiIDList string) (bool, string, error) { db := d.db now := time.Now().Format("2006-01-02 15:04:05") Tx, _ := db.Begin() - sql := "DELETE FROM goku_gateway_api A WHERE apiID IN (" + apiIDList + ");" + sql := "DELETE FROM goku_gateway_api WHERE apiID IN (" + apiIDList + ");" _, err := Tx.Exec(sql) if err != nil { Tx.Rollback()