Skip to content

Commit 891b0b4

Browse files
authored
Merge pull request #11 from polyse/bugfix-empty-req
Bugfix empty request
2 parents 2e1e407 + b2d687f commit 891b0b4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/api/api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ func (a *API) handleAddDocuments(c echo.Context) error {
160160
log.Debug().Err(err).Msg("handleAddDocuments Bind err")
161161
return echo.NewHTTPError(http.StatusBadRequest)
162162
}
163+
164+
log.Debug().Interface("docs", docs).Msg("before validating")
165+
if len(docs.Documents) == 0 {
166+
return c.JSON(http.StatusOK, docs)
167+
}
168+
163169
if err = c.Validate(docs); err != nil {
164170
log.Debug().Err(err).Msg("handleAddDocuments Validate err")
165171
return echo.NewHTTPError(http.StatusBadRequest)

0 commit comments

Comments
 (0)