-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from bento-platform/releases/v3.9
v3.9
- Loading branch information
Showing
13 changed files
with
149 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
GOHAN_DEBUG=false | ||
GOHAN_SERVICE_CONTACT=[email protected] | ||
GOHAN_SEMVER=3.8.0 | ||
GOHAN_SEMVER=3.9.0 | ||
GOHAN_SERVICES="gateway api elasticsearch kibana drs authorization" | ||
|
||
# GOOS=linux | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
package middleware | ||
|
||
import ( | ||
"net/http" | ||
"gohan/api/contexts" | ||
"strings" | ||
|
||
"github.com/labstack/echo" | ||
) | ||
|
||
/* | ||
Echo middleware to ensure a singular `id` HTTP query parameter was provided | ||
Echo middleware to prepare the context for an optionall provided singular `id` HTTP query parameter | ||
*/ | ||
func MandateSampleIdsSingularAttribute(next echo.HandlerFunc) echo.HandlerFunc { | ||
func CalibrateOptionalSampleIdsSingularAttribute(next echo.HandlerFunc) echo.HandlerFunc { | ||
return func(c echo.Context) error { | ||
gc := c.(*contexts.GohanContext) | ||
|
||
// check for id query parameter | ||
sampleId := c.QueryParam("id") | ||
if len(sampleId) == 0 { | ||
// if no id was provided return an error | ||
return echo.NewHTTPError(http.StatusBadRequest, "Missing 'id' query parameter for sample id querying!") | ||
sampleId = "*" // wildcard | ||
} | ||
|
||
return next(c) | ||
gc.SampleIds = append(gc.SampleIds, sampleId) | ||
return next(gc) | ||
} | ||
} | ||
|
||
/* | ||
Echo middleware to ensure a pluralized `id` (spelled `ids`) HTTP query parameter was provided | ||
Echo middleware to prepare the context for an optionally provided pluralized `id` (spelled `ids`) HTTP query parameter | ||
*/ | ||
func MandateSampleIdsPluralAttribute(next echo.HandlerFunc) echo.HandlerFunc { | ||
func CalibrateOptionalSampleIdsPluralAttribute(next echo.HandlerFunc) echo.HandlerFunc { | ||
return func(c echo.Context) error { | ||
gc := c.(*contexts.GohanContext) | ||
|
||
// check for id's query parameter | ||
sampleIds := strings.Split(c.QueryParam("ids"), ",") | ||
if len(sampleIds) == 0 { | ||
// if no ids were provided return an error | ||
return echo.NewHTTPError(http.StatusBadRequest, "Missing 'ids' query parameter for sample id querying!") | ||
var ( | ||
sampleIdQP = c.QueryParam("ids") | ||
sampleIds []string | ||
) | ||
if len(sampleIdQP) > 0 { | ||
sampleIds = strings.Split(sampleIdQP, ",") | ||
} else { | ||
sampleIds = append(sampleIds, "*") // wildcard | ||
} | ||
|
||
return next(c) | ||
gc.SampleIds = append(gc.SampleIds, sampleIds...) | ||
return next(gc) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.