Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unique version names in multiple versions' key API #2812

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions api/v2/translation/handler_trans.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
package translation

import (
"io/ioutil"
"io"
"strings"

"sgtnserver/api"
"sgtnserver/internal/common"
"sgtnserver/internal/logger"
"sgtnserver/internal/sgtnerror"
"sgtnserver/modules/translation"
"sgtnserver/modules/translation/translationservice"
"strings"

"github.com/StudioSol/set"
"github.com/emirpasic/gods/sets/linkedhashset"
"github.com/gin-gonic/gin"
jsoniter "github.com/json-iterator/go"
Expand Down Expand Up @@ -311,6 +313,7 @@
var versions []string
if params.Versions != api.AllVersions {
versions = strings.Split(params.Versions, common.ParamSep)
versions = set.NewLinkedHashSetString(versions...).AsSlice()

Check warning on line 316 in api/v2/translation/handler_trans.go

View check run for this annotation

Codecov / codecov/patch

api/v2/translation/handler_trans.go#L316

Added line #L316 was not covered by tests
}

var result []interface{}
Expand Down Expand Up @@ -354,7 +357,7 @@
}

if c.Request.Body != nil {
if bts, err := ioutil.ReadAll(c.Request.Body); err != nil {
if bts, err := io.ReadAll(c.Request.Body); err != nil {

Check warning on line 360 in api/v2/translation/handler_trans.go

View check run for this annotation

Codecov / codecov/patch

api/v2/translation/handler_trans.go#L360

Added line #L360 was not covered by tests
api.AbortWithError(c, sgtnerror.StatusBadRequest.WrapErrorWithMessage(err, "fail to read request body"))
return
} else {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module sgtnserver
go 1.20

require (
github.com/StudioSol/set v1.0.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/anargu/gin-brotli v0.0.0-20220116052358-12bf532d5267
github.com/aws/aws-sdk-go-v2/service/sts v1.23.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6Xge
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/StudioSol/set v1.0.0 h1:G27J71la+Da08WidabBkoRrvPLTa4cdCn0RjvyJ5WKQ=
github.com/StudioSol/set v1.0.0/go.mod h1:hIUNZPo6rEGF43RlPXHq7Fjmf+HkVJBqAjtK7Z9LoIU=
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 h1:ZBbLwSJqkHBuFDA6DUhhse0IGJ7T5bemHyNILUjvOq4=
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2/go.mod h1:VSw57q4QFiWDbRnjdX8Cb3Ow0SFncRw+bA/ofY6Q83w=
github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
Expand Down
Loading