From c43aca38811716ba8573f8978c38f82f49c73486 Mon Sep 17 00:00:00 2001 From: Lyuben Penkovski <lyuben.penkovski@vereign.com> Date: Tue, 5 Apr 2022 08:33:30 +0000 Subject: [PATCH] Apply 4 suggestion(s) to 3 file(s) --- README.md | 4 ++-- design/design.go | 2 +- internal/service/cache/service.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 017f378..c128eb8 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ flowchart LR ### API Documentation The API Documentation is accessible at `/swagger-ui` path in OAS 3.0 format. -Example: `localhost:8080/swagger-ui` +Example: `http://localhost:8080/swagger-ui` -### Prerequisites +### Dependencies There must be a running instance of [Redis](https://redis.io/) visible to the service. The address, username and password of the Redis in-memory store instance must be provided as environment variables. diff --git a/design/design.go b/design/design.go index 597055d..5ac91e8 100644 --- a/design/design.go +++ b/design/design.go @@ -64,7 +64,7 @@ var _ = Service("cache", func() { }) Method("Set", func() { - Description("Set value in the cache. The HTTP request body is stored as value and the key is assembled from HTTP request headers.") + Description("Set a JSON value in the cache.") Payload(CacheSetRequest) Result(Empty) diff --git a/internal/service/cache/service.go b/internal/service/cache/service.go index 3e89fe1..ee824a4 100644 --- a/internal/service/cache/service.go +++ b/internal/service/cache/service.go @@ -53,7 +53,7 @@ func (s *Service) Get(ctx context.Context, req *cache.CacheGetRequest) ([]byte, func (s *Service) Set(ctx context.Context, req *cache.CacheSetRequest) error { var operation = zap.String("operation", "set") - if req.Key == "" || req.Namespace == "" || req.Scope == "" || len(req.Data.(map[string]interface{})) == 0 { + if req.Key == "" || req.Namespace == "" || req.Scope == "" { s.logger.Error("bad request: missing key or namespace or scope or data", operation) return errors.New(errors.BadRequest, "bad request") } -- GitLab