diff --git a/app/handlers/apiv1/post.go b/app/handlers/apiv1/post.go index 7d4f41d4f..9fb086be3 100644 --- a/app/handlers/apiv1/post.go +++ b/app/handlers/apiv1/post.go @@ -15,9 +15,13 @@ import ( // SearchPosts return existing posts based on search criteria func SearchPosts() web.HandlerFunc { return func(c *web.Context) error { + viewQueryParams := c.QueryParam("view") + if viewQueryParams == "" { + viewQueryParams = "all" // Set default value to "all" if not provided + } searchPosts := &query.SearchPosts{ Query: c.QueryParam("query"), - View: c.QueryParam("view"), + View: viewQueryParams, Limit: c.QueryParam("limit"), Tags: c.QueryParamAsArray("tags"), }